Slope Calculator
Enter two points and this gives you the slope, the equation of the line through them, the angle it makes with the horizontal, and the distance between the points.
How the math works
slope m = (y2 - y1) / (x2 - x1), which is the rise divided by the run. Once you have m, the intercept comes from either point: b = y1 - m x1, and the line is y = mx + b. The angle is arctan(m), in degrees. The percent grade is just the slope times 100, which is why a 100 percent grade is 45 degrees and not vertical - a fact that surprises people looking at a road sign. The distance is Pythagoras on the rise and the run, and the midpoint is the average of each coordinate separately.
Common questions
- How do I find the slope between two points?
- Subtract the y values, subtract the x values in the same order, and divide. From (2, 3) to (8, 12) the rise is 9 and the run is 6, so the slope is 1.5. The order of the two points does not matter as long as you keep it consistent in both subtractions.
- What does a negative slope mean?
- The line falls as you read left to right. Every step to the right takes you down. A slope of -2 means down 2 for every 1 across.
- Why is the slope of a vertical line undefined rather than infinite?
- Because the run is zero, and dividing by zero has no value at all. Saying it is infinite would imply a single answer, and a vertical line has none. It is written as x = a constant instead.
- What is the difference between slope and grade?
- They are the same quantity in different clothes. Grade is the slope written as a percent, so a slope of 0.08 is an 8 percent grade. Roads and railways use grade, math classes use slope.
- How steep is a 100 percent grade?
- 45 degrees. A percent grade is rise over run, so 100 percent means you rise as much as you travel forward. People often assume it means vertical, which would be an infinite grade.
- How do I find a line perpendicular to this one?
- Flip the slope and change its sign. A slope of 1.5 becomes -0.667. The two multiplied together give -1, which is the test for perpendicular lines in the plane.