Free tool

Slope calculator

Finds the slope of the line through two points and shows every step, plus the equation of the line and its graph. Whole numbers, decimals and fractions like 3/4 all work.

Point 1 (, )Point 2 (, )

The slope formula

Slope measures how steep a line is: how far it rises for each step to the right. For two points (x₁, y₁) and (x₂, y₂):

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

The top is the rise (change in y) and the bottom is the run (change in x). That is why slope is called "rise over run".

SlopeWhat the line doesExample
PositiveGoes up from left to right(1, 2) and (4, 8): slope 2
NegativeGoes down from left to right(0, 5) and (2, 1): slope −2
ZeroHorizontal(1, 4) and (6, 4): slope 0
UndefinedVertical(3, 1) and (3, 7): no slope

From the slope to the equation of the line

Slope-intercept form is y = mx + b, where m is the slope and b is where the line crosses the y-axis. Once you have m, put one of the points in and solve for b. The calculator does this as its last step.

Mistakes to avoid

  • Mixing the order. If the top is y₂ − y₁, the bottom must be x₂ − x₁, not x₁ − x₂.
  • Putting x on top. Rise is the change in y. It goes on top.
  • Losing a negative sign. 3 − (−2) is 5, not 1.
  • Calling a vertical line's slope 0. Zero is for horizontal lines. A vertical line has no slope.

For the method by hand with more worked examples and practice problems, see how to find the slope of a line from two points.

Questions people ask

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₁). For (1, 2) and (4, 8) that is (8 − 2) / (4 − 1) = 6 / 3 = 2.

What is the slope of a horizontal line?

Zero. The y-values are equal, so the rise is 0, and 0 divided by any run is 0.

What is the slope of a vertical line?

It is undefined. The x-values are equal, so the run is 0, and you cannot divide by 0. The equation of the line is x = a number.

Does it matter which point is first?

No, as long as you use the same order on the top and the bottom. Swapping both changes both signs, and the two sign changes cancel.

How do you get the equation of the line from the slope?

Put the slope m and one of the points into y = mx + b and solve for b. With slope 2 through (1, 2): 2 = 2·1 + b, so b = 0 and the line is y = 2x.

If your slope question comes wrapped in a word problem or a graph on a worksheet, the MathBox Solver can read it from a photo or PDF and explain it step by step.