Slope Calculator

Enter two points. Get the slope, the equation of the line, the distance and the midpoint.

How it works

Slope is the change in y divided by the change in x. The y-intercept comes from putting one point into y = mx + b. A vertical line has no slope, so its equation is x = a number.

Example

Find the line through (โˆ’2, 5) and (4, โˆ’1).

y = โˆ’x + 3

Slope
โˆ’1
y-intercept
3
Distance
6โˆš2 โ‰ˆ 8.4853
Midpoint
(1, 2)

Steps

  1. Change in y: โˆ’1 โˆ’ 5 = โˆ’6. Change in x: 4 โˆ’ (โˆ’2) = 6.
  2. Slope: m = โˆ’6 / 6 = โˆ’1.
  3. Find the y-intercept with the first point: b = 5 โˆ’ (โˆ’1)ยท(โˆ’2) = 3.

More examples

Find the line through (0, 4) and (6, 4).

y = 4

Slope
0
y-intercept
4
Distance
6
Midpoint
(3, 4)

Steps

  1. Change in y: 4 โˆ’ 4 = 0. Change in x: 6 โˆ’ 0 = 6.
  2. Slope: m = 0 / 6 = 0.
  3. Find the y-intercept with the first point: b = 4 โˆ’ 0ยท0 = 4.

Find the line through (3, 1) and (3, 7).

x = 3

Slope
Undefined
Distance
6
Midpoint
(3, 4)

Steps

  1. Change in y: 7 โˆ’ 1 = 6. Change in x: 3 โˆ’ 3 = 0.
  2. The change in x is 0, so the slope is undefined: this is a vertical line.

Common mistake

Subtract in the same order on top and bottom. Mixing them flips the sign of the slope.

Questions

What do the different slopes look like?

A positive slope rises left to right, a negative slope falls, and a slope of 0 is flat. A vertical line has an undefined slope.

How can I tell if two lines are parallel or perpendicular?

Parallel lines have the same slope. Perpendicular slopes multiply to โˆ’1, like 2 and โˆ’1/2.

Does it matter which point comes first?

No, as long as you subtract in the same order on top and bottom.

Keep going