★ MATH · LINES · SLOPE & INTERCEPT

Slope Calculator: Find Slope, Intercept & Equation

The line through (1, 2) and (4, 8) has slope 2.00 and y-intercept 0.00 — y = 2x. Find the slope of a line from two points, with the intercept, the equation, the distance between the points and the angle — or give one point and a slope instead. This one is the SLOPE tool — rise over run for a straight line — the ramp-slope-calculator page is the RAMP SLOPE tool — the slope of a physical ramp, with the 1:12 rule — not a line on a graph; the graphing-calculator page is the GRAPHING tool — plotting y = f(x) — not the slope between two points; and the fraction-calculator page is the FRACTION tool — adding and multiplying fractions — not lines. No slope calculator exists on this site — this one is the first.

1374

Slope calculator

Find the slope of a line from two points: rise over run, the y-intercept, the equation in slope-intercept form, the distance between the points and the angle. On the defaults it is (1, 2) to (4, 8) — slope 2.00, intercept 0.00, y = 2x. A vertical line has an undefined slope, and the calculator says so instead of printing 0.

Two points, or one point and a slope — either pair fixes the line.

The x-coordinate of the first point — 1 on the defaults.

The y-coordinate of the first point — 2 on the defaults.

The x-coordinate of the second point — 4 on the defaults.

The y-coordinate of the second point — 8 on the defaults.

The slope of the line — 2 on the defaults.

(1, 2) → (4, 8): slope 2.00, intercept 0.00, y = 2x, distance 6.708204, angle 63.434949°2.00Slope 2.00. (8 − 2) ÷ (4 − 1) = 6 ÷ 3 — the line is y = 2x.

Slope: 2.00

Slope (6dp unrounded): 2.000000

Y-intercept: 0.00

Equation: y = 2x

Distance: 6.708204

Angle: 63.434949°

Rise: 6

Run: 3

Midpoint: (2.50, 5.00)

Grade: 200.00%

Verdict: The line through (1, 2) → (4, 8) has slope 2.00 and y-intercept 0.00 — y = 2x. The points are 6.708204 apart, and the line rises at 63.434949°.

(0, 0) → (3, 4): (0, 0) → (3, 4): slope 1.33, intercept 0.00, y = 1.33x, distance 5.000000, angle 53.130102°

Horizontal: (0, 5) → (4, 5): (0, 5) → (4, 5): slope 0.00, intercept 5.00, y = 5, distance 4.000000, angle 0.000000°

Downhill: (0, 10) → (5, 0): (0, 10) → (5, 0): slope −2.00, intercept 10.00, y = −2x + 10, distance 11.180340, angle −63.434949°

Vertical: (2, 3) → (2, 9): x = 2 is a vertical line — the slope is undefined, not 0 and not infinity.

(1, 1) → (2, 3): (1, 1) → (2, 3): slope 2.00, intercept −1.00, y = 2x − 1, distance 2.236068, angle 63.434949°

(0, 0) → (1, 1): (0, 0) → (1, 1): slope 1.00, intercept 0.00, y = x, distance 1.414214, angle 45.000000°

Point-slope: (1, 2), slope 2: Point (1, 2), slope 2.00: slope 2.00, intercept 0.00, y = 2x, distance —, angle 63.434949°

(−3, −1) → (2, 4): (−3, −1) → (2, 4): slope 1.00, intercept 2.00, y = x + 2, distance 7.071068, angle 45.000000°

Reverse: Largest whole x2 for which the slope from (1, 2) to (x2, 8) is still 2 or more: 4

Reverse: Largest whole x2 for which the slope from (1, 2) to (x2, 8) is still 2 or more (rounded): 4

At 4 the figures are: (1, 2) → (4, 8): slope 2.00, intercept 0.00, y = 2x, distance 6.708204, angle 63.434949°

At the lower neighbor the figures are: (1, 2) → (3, 8): slope 3.00, intercept −1.00, y = 3x − 1, distance 6.324555, angle 71.565051°

At the upper neighbor the figures are: (1, 2) → (5, 8): slope 1.50, intercept 0.50, y = 1.5x + 0.5, distance 7.211103, angle 56.309932°

Reverse verdict: STEP

Reverse: Smallest whole y2 for which the slope from (1, 2) to (4, y2) is 2 or more: 8

Reverse: Smallest whole y2 for which the slope from (1, 2) to (4, y2) is 2 or more (rounded): 8

At 8 the figures are: (1, 2) → (4, 8): slope 2.00, intercept 0.00, y = 2x, distance 6.708204, angle 63.434949°

At the lower neighbor the figures are: (1, 2) → (4, 7): slope 1.67, intercept 0.33, y = 1.67x + 0.33, distance 5.830952, angle 59.036243°

At the upper neighbor the figures are: (1, 2) → (4, 9): slope 2.33, intercept −0.33, y = 2.33x − 0.33, distance 7.615773, angle 66.801409°

Reverse verdict: STEP

Reverse: Smallest whole slope through (1, 2) with a y-intercept of 0 or less: 2

Reverse: Smallest whole slope through (1, 2) with a y-intercept of 0 or less (rounded): 2

At 2 the figures are: Point (1, 2), slope 2.00: slope 2.00, intercept 0.00, y = 2x, distance —, angle 63.434949°

At the lower neighbor the figures are: Point (1, 2), slope 1.00: slope 1.00, intercept 1.00, y = x + 1, distance —, angle 45.000000°

At the upper neighbor the figures are: Point (1, 2), slope 3.00: slope 3.00, intercept −1.00, y = 3x − 1, distance —, angle 71.565051°

Reverse verdict: STEP

Edge: Vertical line (2, 3) → (2, 9): x = 2 is a vertical line — the slope is undefined, not 0 and not infinity.

Edge: Same point twice (1, 2) → (1, 2): The two points are the same — infinitely many lines pass through one point, so there is no single slope to find.

Edge: Non-numeric x1: Enter a number for every coordinate — x1, y1, x2 and y2 must all be numbers.

Edge: Horizontal line (0, 5) → (4, 5): (0, 5) → (4, 5): slope 0.00, intercept 5.00, y = 5, distance 4.000000, angle 0.000000°

Edge: Point-slope with slope 0: Point (1, 2), slope 0.00: slope 0.00, intercept 2.00, y = 2, distance —, angle 0.000000°

Edge: Infinite input: Enter a number for every coordinate — x1, y1, x2 and y2 must all be numbers.

The line through (1, 2) → (4, 8) has slope 2.00 and y-intercept 0.00 — y = 2x. The points are 6.708204 apart, and the line rises at 63.434949°.

(0, 0) → (3, 4): (0, 0) → (3, 4): slope 1.33, intercept 0.00, y = 1.33x, distance 5.000000, angle 53.130102°.

Horizontal: (0, 5) → (4, 5): (0, 5) → (4, 5): slope 0.00, intercept 5.00, y = 5, distance 4.000000, angle 0.000000°.

Downhill: (0, 10) → (5, 0): (0, 10) → (5, 0): slope −2.00, intercept 10.00, y = −2x + 10, distance 11.180340, angle −63.434949°.

Vertical: (2, 3) → (2, 9): x = 2 is a vertical line — the slope is undefined, not 0 and not infinity..

(1, 1) → (2, 3): (1, 1) → (2, 3): slope 2.00, intercept −1.00, y = 2x − 1, distance 2.236068, angle 63.434949°.

(0, 0) → (1, 1): (0, 0) → (1, 1): slope 1.00, intercept 0.00, y = x, distance 1.414214, angle 45.000000°.

Point-slope: (1, 2), slope 2: Point (1, 2), slope 2.00: slope 2.00, intercept 0.00, y = 2x, distance —, angle 63.434949°.

(−3, −1) → (2, 4): (−3, −1) → (2, 4): slope 1.00, intercept 2.00, y = x + 2, distance 7.071068, angle 45.000000°.

Reverse: The Largest whole x2 for which the slope from (1, 2) to (x2, 8) is still 2 or more is 4; at 4 the figures are (1, 2) → (4, 8): slope 2.00, intercept 0.00, y = 2x, distance 6.708204, angle 63.434949°; at the lower neighbor the figures are (1, 2) → (3, 8): slope 3.00, intercept −1.00, y = 3x − 1, distance 6.324555, angle 71.565051°; at the upper neighbor the figures are (1, 2) → (5, 8): slope 1.50, intercept 0.50, y = 1.5x + 0.5, distance 7.211103, angle 56.309932° — verdict: STEP. Reverse: The Smallest whole y2 for which the slope from (1, 2) to (4, y2) is 2 or more is 8; at 8 the figures are (1, 2) → (4, 8): slope 2.00, intercept 0.00, y = 2x, distance 6.708204, angle 63.434949°; at the lower neighbor the figures are (1, 2) → (4, 7): slope 1.67, intercept 0.33, y = 1.67x + 0.33, distance 5.830952, angle 59.036243°; at the upper neighbor the figures are (1, 2) → (4, 9): slope 2.33, intercept −0.33, y = 2.33x − 0.33, distance 7.615773, angle 66.801409° — verdict: STEP. Reverse: The Smallest whole slope through (1, 2) with a y-intercept of 0 or less is 2; at 2 the figures are Point (1, 2), slope 2.00: slope 2.00, intercept 0.00, y = 2x, distance —, angle 63.434949°; at the lower neighbor the figures are Point (1, 2), slope 1.00: slope 1.00, intercept 1.00, y = x + 1, distance —, angle 45.000000°; at the upper neighbor the figures are Point (1, 2), slope 3.00: slope 3.00, intercept −1.00, y = 3x − 1, distance —, angle 71.565051° — verdict: STEP.

Edges: Vertical line (2, 3) → (2, 9) gives x = 2 is a vertical line — the slope is undefined, not 0 and not infinity.. Same point twice (1, 2) → (1, 2) gives The two points are the same — infinitely many lines pass through one point, so there is no single slope to find.. Non-numeric x1 gives Enter a number for every coordinate — x1, y1, x2 and y2 must all be numbers.. Horizontal line (0, 5) → (4, 5) gives (0, 5) → (4, 5): slope 0.00, intercept 5.00, y = 5, distance 4.000000, angle 0.000000°. Point-slope with slope 0 gives Point (1, 2), slope 0.00: slope 0.00, intercept 2.00, y = 2, distance —, angle 0.000000°. Infinite input gives Enter a number for every coordinate — x1, y1, x2 and y2 must all be numbers..

What does a slope of 2 mean?

It means the line rises 2 units for every 1 unit it runs: from (1, 2) to (4, 8) the line climbs 6 over a run of 3, and 6 ÷ 3 is 2. The equation is y = 2x — double the x, and you get the y — and the line crosses the y-axis at 0, so the intercept is 0.00. The two points are 6.708204 apart, and the line rises at 63.434949° to the horizontal. A slope of 2 is the same as a grade of 200%: a 200% grade climbs two metres for every metre forward.

Three things to check before you trust the number

Subtract in the same order, both times. The slope is (y2 − y1) ÷ (x2 − x1): if you take y2 minus y1 on top, you must take x2 minus x1 underneath. Mixing the order — (y1 − y2) ÷ (x2 − x1) — flips the sign, and the line comes out sloping the wrong way. The calculator subtracts the first point from the second, both times.

A vertical line has no slope — and that is not the same as a slope of 0. For (2, 3) → (2, 9) the run is 0, so rise over run divides by zero and the slope is undefined. A slope of 0 is a flat line, y = 5; an undefined slope is a vertical line, x = 2. The calculator says so plainly instead of printing 0 or infinity.

Slope and gradient are the same number for a straight line — until they are not. In school maths the two words mean the same thing: rise over run. In calculus and physics, "gradient" also means a direction — a vector pointing the way a surface climbs fastest — while slope stays a single number. For one straight line on a graph, the answer is the same either way.

Worked example

On the defaults: (1, 2) → (4, 8).

  1. Find the rise: 8 − 2 is 6.
  2. Find the run: 4 − 1 is 3.
  3. Divide: 6 ÷ 3 is 2.00 — the slope.
  4. Find the intercept: 2 − 2 × 1 is 0.00.
  5. Write the equation: y = 2x.

And the other way: the largest whole x2 for which the slope from (1, 2) to (x2, 8) is still 2 or more is 4 — at x2 = 5 the slope falls to 1.50. And the smallest whole y2 for which the slope from (1, 2) to (4, y2) is 2 or more is 8.

Every branch, checked

The reverses, worked backwards

What the defaults assume

The defaults are the points (1, 2) and (4, 8) — chosen because the rise of 6 and the run of 3 divide cleanly to a slope of 2, and the line passes through the origin, so the intercept is 0. They are a starting point, not a lesson: type any two points and the calculator finds the slope, the intercept, the equation, the distance, the angle and the midpoint — or switch to point-and-slope mode and give one point and a slope instead. The distance is the straight-line distance between the points, and the angle is measured from the horizontal in degrees. A vertical line is reported as undefined, and two identical points have no single slope at all.

These notes repeat in every explainer section because this page is built to be read start to finish: subtract in the same order, both times; a vertical line has no slope and that is not a slope of 0; and slope and gradient are the same number for a straight line.

Output · formula · meaning

OutputFormulaWhat it means
Sloperise ÷ run2.00.
Slope (6dp unrounded)decimal, 6 places2.000000.
Y-intercepty1 − slope × x10.00.
Equationslope-intercept formy = 2x.
Distance√((x2 − x1)² + (y2 − y1)²)6.708204.
Anglearctan(slope)63.434949°.
Risey2 − y16.
Runx2 − x13.
Midpointaverage of the points(2.50, 5.00).
Gradeslope × 100200.00%.
Verdictin wordsThe line through (1, 2) → (4, 8) has slope 2.00.
Reverse: Largest whole x2 for which the slope from (1, 2) to (x2, 8) is still 2 or morestep4: (1, 2) → (4, 8): slope 2.00, intercept 0.00, y = 2x, distance 6.708204, angle 63.434949°.
Reverse: Smallest whole y2 for which the slope from (1, 2) to (4, y2) is 2 or morestep8: (1, 2) → (4, 8): slope 2.00, intercept 0.00, y = 2x, distance 6.708204, angle 63.434949°.
Reverse: Smallest whole slope through (1, 2) with a y-intercept of 0 or lessstep2: Point (1, 2), slope 2.00: slope 2.00, intercept 0.00, y = 2x, distance —, angle 63.434949°.
(0, 0) → (3, 4)same model(0, 0) → (3, 4): slope 1.33, intercept 0.00, y = 1.33x, distance 5.000000, angle 53.130102°.
Horizontal: (0, 5) → (4, 5)same model(0, 5) → (4, 5): slope 0.00, intercept 5.00, y = 5, distance 4.000000, angle 0.000000°.
Downhill: (0, 10) → (5, 0)same model(0, 10) → (5, 0): slope −2.00, intercept 10.00, y = −2x + 10, distance 11.180340, angle −63.434949°.
Vertical: (2, 3) → (2, 9)same modelx = 2 is a vertical line — the slope is undefined, not 0 and not infinity..
(1, 1) → (2, 3)same model(1, 1) → (2, 3): slope 2.00, intercept −1.00, y = 2x − 1, distance 2.236068, angle 63.434949°.
(0, 0) → (1, 1)same model(0, 0) → (1, 1): slope 1.00, intercept 0.00, y = x, distance 1.414214, angle 45.000000°.
Point-slope: (1, 2), slope 2same modelPoint (1, 2), slope 2.00: slope 2.00, intercept 0.00, y = 2x, distance —, angle 63.434949°.
(−3, −1) → (2, 4)same model(−3, −1) → (2, 4): slope 1.00, intercept 2.00, y = x + 2, distance 7.071068, angle 45.000000°.
Vertical line (2, 3) → (2, 9)same modelx = 2 is a vertical line — the slope is undefined, not 0 and not infinity..
Same point twice (1, 2) → (1, 2)same modelThe two points are the same — infinitely many lines pass through one point, so there is no single slope to find..
Non-numeric x1same modelEnter a number for every coordinate — x1, y1, x2 and y2 must all be numbers..
Horizontal line (0, 5) → (4, 5)same model(0, 5) → (4, 5): slope 0.00, intercept 5.00, y = 5, distance 4.000000, angle 0.000000°.
Point-slope with slope 0same modelPoint (1, 2), slope 0.00: slope 0.00, intercept 2.00, y = 2, distance —, angle 0.000000°.
Infinite inputsame modelEnter a number for every coordinate — x1, y1, x2 and y2 must all be numbers..

Who uses this

Accuracy & limitations

Results are exact for the numbers you type; displays round the slope and intercept to 2 decimal places and the distance and angle to 6. The slope itself is a division, so a slope like 4/3 is shown as 1.33 to two places and 1.333333 to six — the exact value is 4/3, and the equation y = 1.33x carries the rounded slope, not the exact one. The angle comes from the arctangent of the slope and is measured in degrees from the horizontal; a downhill line has a negative angle. The distance is the straight-line distance between the two points. A vertical line is undefined, never 0 or infinity, and two identical points have no single slope — the calculator says so instead of inventing one.

Cite this calculator

The line through (1, 2) → (4, 8) has slope 2.00 and y-intercept 0.00 — y = 2x. The points are 6.708204 apart, and the line rises at 63.434949°. (0, 0) → (3, 4) has slope 1.33 (exactly 4/3) and distance 5.000000; (0, 5) → (4, 5) has slope 0.00; (0, 10) → (5, 0) has slope −2.00. (2, 3) → (2, 9) is vertical — the slope is undefined. Largest whole x2 for which the slope from (1, 2) to (x2, 8) is still 2 or more: 4. Smallest whole y2 for which the slope from (1, 2) to (4, y2) is 2 or more: 8. Smallest whole slope through (1, 2) with a y-intercept of 0 or less: 2. Source: Bright Side Kit, brightoolbox.com.

Embed this calculator

Frequently asked questions

How do you find the slope between two points?

Divide the rise by the run — (y2 − y1) ÷ (x2 − x1). For (1, 2) → (4, 8) that is (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2.00.

What is the slope of y = 2x?

The slope of y = 2x is 2 — the number in front of x — and the y-intercept is 0. The line passes through (1, 2) and (4, 8).

What is the slope of a vertical line?

A vertical line has an undefined slope — the run is 0, so rise over run divides by zero. For (2, 3) → (2, 9) there is no slope to find; it is not 0 and not infinity.

What is the slope of a horizontal line?

A horizontal line has a slope of 0 — the rise is 0. For (0, 5) → (4, 5) the line is y = 5, flat, at an angle of 0°.

How do you find the y-intercept from two points?

Work out the slope, then take y1 − slope × x1. For (1, 2) → (4, 8) the slope is 2, so the intercept is 2 − 2 × 1 = 0.00.

What is the distance between (1, 2) and (4, 8)?

The distance is 6.708204 — the square root of (4 − 1)² + (8 − 2)², which is the square root of 45.

Is slope the same as gradient?

For a straight line, yes — both mean rise over run. In calculus and physics, "gradient" also means a direction, a vector pointing the way a surface climbs fastest, while slope stays a single number.

How do you use point-slope form?

Take one point and the slope: y − y1 = m(x − x1). For the point (1, 2) with slope 2 that is y − 2 = 2(x − 1), which is y = 2x.