Slope Calculator

Find the slope between two points (x1,y1) and (x2,y2) as an exact reduced fraction, plus point-slope, slope-intercept, and standard line equations.

Loading calculator…

The slope formula

The slope mm of the line through (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is:

m=ΔyΔx=y2y1x2x1m = \frac{\Delta y}{\Delta x} = \frac{y_2 - y_1}{x_2 - x_1}

This is "rise over run": Δy\Delta y is how far the line rises (or falls) vertically, and Δx\Delta x is how far it runs horizontally, between the two points.

Tip: Subtract the coordinates in the same order on top and bottom — y2y1y_2-y_1 over x2x1x_2-x_1, never y2y1y_2-y_1 over x1x2x_1-x_2. Swapping which point is "1" and which is "2" flips both differences at once, so the slope comes out the same either way, but mixing the order for just one of the two differences flips the sign of the answer.

Two special cases

  • Horizontal line (Δy=0\Delta y = 0): the slope is exactly 00yy never changes.
  • Vertical line (Δx=0\Delta x = 0): the slope is undefined — division by zero has no value. A vertical line's equation is simply x=x1x = x_1.

These are opposite situations, not the same: a 00 slope is a perfectly real, flat line; an undefined slope means there is no single rate of rise per unit of run, because the run itself is zero.

Three equations for the same line

Once the slope mm and a point (x1,y1)(x_1,y_1) are known, the line can be written three ways:

Point-slope form: yy1=m(xx1)y - y_1 = m(x - x_1)

Slope-intercept form: solve point-slope for yy to get y=mx+by = mx + b, where b=y1mx1b = y_1 - mx_1 is the yy-intercept.

Standard form: clear the fractions in slope-intercept form and move every term to one side: Ax+By=CAx + By = C, with AA, BB, CC integers, A0A \geq 0, and no common factor other than 11.

Worked example

For (2,3)(2, 3) and (7,9)(7, -9): Δy=93=12\Delta y = -9-3 = -12 and Δx=72=5\Delta x = 7-2 = 5, so m=125=2.4m = -\frac{12}{5} = -2.4.

Point-slope through (2,3)(2,3): y3=125(x2)y - 3 = -\frac{12}{5}(x-2).

Solving for yy: y=125x+395y = -\frac{12}{5}x + \frac{39}{5} (so b=395=7.8b = \frac{39}{5} = 7.8).

Clearing denominators: 12x+5y=3912x + 5y = 39.

The line crosses the yy-axis at (0,395)\left(0, \frac{39}{5}\right) and the xx-axis at (134,0)\left(\frac{13}{4}, 0\right) — found by setting x=0x=0 (giving y=by=b) and y=0y=0 (giving x=bmx=-\frac{b}{m}) in slope-intercept form.

Parallel and perpendicular slopes

A line parallel to this one has the identical slope mm. A line perpendicular to it has the negative reciprocal slope 1m-\frac{1}{m} — for m=125m=-\frac{12}{5}, that's 512\frac{5}{12}. A horizontal line (m=0m=0) is perpendicular to a vertical one (undefined slope), and vice versa.

Related calculators

The same two points also determine the Distance Between Two Points between them (the straight-line length of the segment) — this calculator instead finds how steep that segment is, and every equation of the line through it. Slope and the Quadratic Formula both describe curves from their coefficients; a line is simply the degree-1 case (mm and bb instead of aa, bb, and cc).

Frequently asked questions

What is the slope formula?
The slope mm of the line through (x1,y1)(x_1,y_1) and (x2,y2)(x_2,y_2) is m=ΔyΔx=y2y1x2x1m = \frac{\Delta y}{\Delta x} = \frac{y_2-y_1}{x_2-x_1} — "rise over run": how much yy changes for every unit xx changes.
Why is the slope of a vertical line undefined?
A vertical line has x2=x1x_2 = x_1, so Δx=0\Delta x = 0. The slope formula would divide by zero, which has no value — so the slope is undefined (does not exist), not zero. A vertical line still has a perfectly good equation, just not a "y=mx+by=mx+b" one: it is x=x1x = x_1 for every point on it.
What is the difference between a slope of 0 and an undefined slope?
A slope of 00 means a horizontal line (Δy=0\Delta y = 0, yy never changes as xx moves). An undefined slope means a vertical line (Δx=0\Delta x = 0, xx never changes). These are opposite, not the same thing — mixing them up is one of the most common slope mistakes.
How do I find the equation of a line from two points?
First find the slope m=y2y1x2x1m = \frac{y_2-y_1}{x_2-x_1}. Then plug mm and either point into point-slope form yy1=m(xx1)y - y_1 = m(x-x_1). Solving that for yy gives slope-intercept form y=mx+by=mx+b; clearing the fractions and moving everything to one side gives standard form Ax+By=CAx+By=C. All three describe the exact same line.
What is the slope of a line parallel to this one?
Exactly the same slope, mm. Parallel lines never meet, which is only possible if they rise and run at the identical rate — any two distinct lines with the same slope are parallel.
What is the slope of a line perpendicular to this one?
The negative reciprocal, 1m-\frac{1}{m} — flip the fraction and flip the sign. For example a slope of 4-4 pairs with a perpendicular slope of 14\frac{1}{4}. When m=0m=0 (horizontal), the perpendicular line is vertical, so its slope is undefined; when mm is undefined (vertical), the perpendicular line is horizontal, with slope 00.
How is the standard form Ax + By = C chosen — couldn't the same line be written many ways?
Yes — multiplying every term by any nonzero constant gives an equivalent equation. This calculator picks the one canonical version: AA, BB, CC are integers with no common factor other than 11, and A0A \geq 0, so every line has exactly one standard-form answer instead of infinitely many equally-valid ones.

Related calculators