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
- Change in y: โ1 โ 5 = โ6. Change in x: 4 โ (โ2) = 6.
- Slope: m = โ6 / 6 = โ1.
- 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
- Change in y: 4 โ 4 = 0. Change in x: 6 โ 0 = 6.
- Slope: m = 0 / 6 = 0.
- 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
- Change in y: 7 โ 1 = 6. Change in x: 3 โ 3 = 0.
- 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.