Slope Calculator – Find the Slope from Two Points

Enter two points to get the slope, the equation of the line, both intercepts, the angle, the distance and the midpoint — with every step shown and a graph.

Runs in your browser 100% free No sign-up
Quick answer

The slope is m = (y₂ − y₁) ÷ (x₂ − x₁), or “rise over run”. For the points (1, 2) and (4, 8): m = (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2, and the line is y = 2x + 0.

How to use Slope Calculator

  1. Enter the coordinates of the first point (x₁, y₁).
  2. Enter the coordinates of the second point (x₂, y₂). Decimals and negative numbers are fine.
  3. Read the slope, shown as a fraction when possible, and the equation of the line.
  4. Check the step-by-step working and the graph to understand the result.

The slope formula

The slope tells you how steep a line is and in which direction it goes. It is the change in y divided by the change in x between two points:

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

People also call it “rise over run”: how far the line goes up (rise) for every step to the right (run).

What the slope tells you

SlopeLineExample
PositiveRises from left to rightm = 2
NegativeFalls from left to rightm = −1/2
ZeroHorizontaly = 3
UndefinedVerticalx = 4

A vertical line has no slope, because the run is zero and you cannot divide by zero. The calculator tells you when that happens and gives the equation x = … instead.

Equations of a line

Once you know the slope, you can write the line in two common forms:

  • Slope-intercept form: y = mx + b, where b is the y-intercept (where the line crosses the y-axis). Find b with b = y₁ − m × x₁.
  • Point-slope form: y − y₁ = m(x − x₁). This is handy when you know one point and the slope.

The x-intercept, where the line crosses the x-axis, is −b ÷ m.

Angle, distance and midpoint

The angle of the line with the x-axis is arctan(m); a slope of 1 is 45°. The distance between the points uses Pythagoras: √((x₂ − x₁)² + (y₂ − y₁)²). The midpoint is the average of the x values and of the y values.

Slope in real life

Slope is used for roads and ramps (as a percentage: slope × 100), roofs (rise per 12 inches of run), and in graphs of speed or cost per unit. A road with a 6% grade rises 6 m for every 100 m. For other homework, the LCM & GCF Calculator shows its working too.

You may also find these free tools useful: GPA Calculator, LCM & GCF Calculator and Standard Deviation Calculator.

Frequently asked questions

How do you find the slope from two points?

Subtract the y values, subtract the x values in the same order, and divide: m = (y₂ − y₁) ÷ (x₂ − x₁).

What is the slope of a horizontal line?

Zero. The y value never changes, so the rise is 0.

What is the slope of a vertical line?

It is undefined, because the run (x₂ − x₁) is 0 and you cannot divide by zero. The equation is x = a constant.

How do I write the equation of a line from two points?

Find the slope m, then b = y₁ − m × x₁. The equation is y = mx + b. The calculator shows both steps.

How do I turn a slope into a percentage or angle?

Multiply the slope by 100 for a percentage grade. For the angle, use arctan(slope); for example, a slope of 0.5 is about 26.6°.

Last updated: