Home
Enter two points on the line and we'll compute m, b, and the full equation.
First point's x-coordinate.
First point's y-coordinate.
Second point's x-coordinate.
Second point's y-coordinate.
Rise over run.
x-coordinate of a known point.
y-coordinate of that same point.
Gradient of the line.
Where the line crosses the y-axis.

What Is the Slope of a Line?

The slope (often written m) measures how steep a line is — the amount it rises (or falls) for each unit it moves to the right. Formally, if you have two points (x₁, y₁) and (x₂, y₂) on a line, the slope is

m = (y₂ − y₁) / (x₂ − x₁)

This is often remembered as rise over run. A positive slope means the line goes up as you move right; a negative slope means it goes down; a slope of zero gives a horizontal line; and an undefined slope (when x₂ = x₁) gives a vertical line.

The Slope-Intercept Form

The most useful way to write a line's equation is the slope-intercept form:

y = mx + b

Here m is the slope and b is the y-intercept — the value of y where the line crosses the y-axis (i.e. when x = 0). Because the y-intercept is so easy to read off this form, it is the standard output for most graphing tools.

The X-Intercept

The x-intercept is where the line crosses the x-axis, so y = 0 at that point. Setting y = 0 in y = mx + b and solving for x gives

x = −b / m (m ≠ 0)

Horizontal lines (m = 0) have no x-intercept unless b = 0, in which case the line lies on the x-axis. Vertical lines cross the x-axis at their defining x-value.

Key formulas this calculator uses:

Slope: m = (y₂ − y₁) / (x₂ − x₁)

y-intercept: b = y₁ − m·x₁

x-intercept: x = −b / m

Distance between points: d = √[(x₂ − x₁)² + (y₂ − y₁)²]

Midpoint: M = ((x₁ + x₂)/2, (y₁ + y₂)/2)

Angle of inclination: θ = arctan(m)

How the Calculator Works

Pick the mode matching the data you have:

  • Two points — enter (x₁, y₁) and (x₂, y₂). The calculator computes the slope with the rise-over-run formula, backs out the y-intercept from one of the points, then reports every form of the equation, the distance, midpoint, and angle of inclination.
  • Slope + point — enter the slope m and any known point (x₁, y₁). The y-intercept is b = y₁ − m·x₁, and the point-slope form is reported directly.
  • Slope + intercept — enter m and b directly. The slope-intercept form is immediate, and the x-intercept follows from −b/m.

Vertical lines (x₂ = x₁ in two-point mode) are handled specially: the slope is undefined, and the equation is reported as x = c rather than y = mx + b. The chart correctly draws a vertical line in that case.

Point-Slope Form

The point-slope form is the most direct way to write a line's equation when you know the slope and one point:

y − y₁ = m(x − x₁)

It's useful for writing the equation quickly, and for derivations such as finding the tangent line to a curve at a point. From point-slope you can always rearrange to slope-intercept or standard form.

Standard (General) Form

The standard form of a line is usually written

Ax + By = C

with A, B, C integers and A ≥ 0 when possible. It has the advantage of handling all lines — including vertical lines — without special cases, and it makes systems of linear equations look tidy. Converting from y = mx + b: multiply both sides by the denominator of the slope, then collect terms.

Special Cases

  • Horizontal line: m = 0, equation y = b. Slope is zero, no steepness.
  • Vertical line: slope undefined, equation x = c. This is not a function y = f(x).
  • Line through the origin: b = 0, equation y = mx.
  • Identical points: rejected as input — infinitely many lines pass through a single point.

Assumptions and Limitations

  • Inputs must be finite real numbers. Complex or infinite values are rejected.
  • For the two-point mode, x₁ ≠ x₂ is required. A vertical line is handled, but the slope is reported as "undefined".
  • Coordinates are limited to −10¹² ≤ value ≤ 10¹² to keep floating-point arithmetic stable.
  • The displayed graph uses an automatically chosen window centred on your points. For very large coordinates, the window may be impractically wide — read the numeric results rather than the picture in that case.
  • This tool treats straight lines only. For curves, use a graphing calculator or a computer algebra system.

❓ Slope and Intercept Calculator FAQ

What is slope in simple terms?

Slope is a number that describes how steep a line is. If the slope is 2, the line goes up 2 units for every 1 unit you move right. A slope of 1/2 means it goes up 1 unit for every 2 units right. Negative slopes tilt downward. Zero slope is horizontal; undefined slope is vertical.

What is the y-intercept?

The y-intercept is the point where the line crosses the y-axis. Since every point on the y-axis has x = 0, the y-intercept is the value of y when x = 0 — the b in the slope-intercept form y = mx + b.

How do I find the x-intercept?

Set y = 0 in y = mx + b and solve for x: 0 = mx + b → x = −b/m. This is where the line crosses the x-axis. Horizontal lines (m = 0) have no x-intercept unless b = 0.

What if my two points have the same x-coordinate?

Then the line is vertical, and its slope is undefined (division by zero). The equation is simply x = c, where c is the shared x-coordinate. The calculator detects this case and reports the vertical form x = c instead of y = mx + b.

What if my two points have the same y-coordinate?

Then the line is horizontal and the slope is 0. The equation simplifies to y = y₁ (or y = b). There is no unique x-intercept unless the line coincides with the x-axis.

Can I enter fractional slopes like 1/2?

Yes. Enter 0.5 in the input field, or enter 1 and 2 in the two-point fields to obtain a slope of 1/2. The result displays both the decimal (0.5) and the fraction (1/2) when the fraction has a small denominator.

What is the point-slope form used for?

The point-slope form y − y₁ = m(x − x₁) is the fastest way to write a line's equation when you know its slope and one point. It's also the standard form for writing the equation of a tangent line or a secant line in calculus.

How do I convert from standard form to slope-intercept form?

Solve for y. If you have Ax + By = C, then By = −Ax + C, so y = (−A/B)x + C/B. In this form the slope is −A/B and the y-intercept is C/B.

What does "angle of inclination" mean?

The angle of inclination θ is the angle the line makes with the positive x-axis, measured counter-clockwise. It's given by θ = arctan(m) for lines with positive or negative slope. Horizontal lines have θ = 0; vertical lines have θ = 90°.

How is the distance between two points calculated?

Using the distance formula (Pythagorean theorem): d = √[(x₂ − x₁)² + (y₂ − y₁)²]. It measures the straight-line length between the two given points, not the arc length of the line (which is infinite).

Why does the calculator report two forms of the equation?

Different forms are useful for different tasks. Slope-intercept (y = mx + b) is best for graphing and reading features. Point-slope (y − y₁ = m(x − x₁)) is best for writing a line from a point and slope. Standard form (Ax + By = C) is best for systems of equations and for handling vertical lines.

Can I use this calculator for vertical lines?

Yes, in two-point mode: if you enter two points with the same x-coordinate, the calculator detects the vertical line and reports x = c. The slope is shown as "undefined". In the slope+point and slope+intercept modes, slopes must be finite numbers, so vertical lines are not representable there — use the two-point mode instead.