How to use this calculator
- 1 Enter the x and y values of the first point.
- 2 Enter the x and y values of the second point.
- 3 Read the slope, angle, distance, y-intercept and the equation of the line.
What is slope?
Slope measures how steep a line is. It compares the rise, the change up or down, with the run, the change across. A line that climbs 2 units for every 1 unit across has a slope of 2.
A positive slope means the line goes up from left to right. A negative slope means it goes down. A slope of zero is flat, and an upright line has no slope at all.
Slope is often written as m. In the equation y = mx + b, m is the slope and b is the point where the line crosses the y-axis.
How the slope is calculated
Start with two points, such as (2, 3) and (6, 11). Subtract the first x from the second x to get the run, which is 4. Then subtract the first y from the second y to get the rise, which is 8.
Divide the rise by the run, so 8 ÷ 4 = 2. The line has a slope of 2. Because the slope is the same between any two points on a straight line, the choice of points does not change the answer.
Next, find the intercept. Put one point into y = mx + b, and solve for b. Here, 3 = 2 × 2 + b, so b = −1. That gives the equation y = 2x − 1.
| Slope | Direction | Example |
|---|---|---|
| 2 | Steep, rising | Rises 2 for every 1 across |
| 1 | Rising at 45° | Rises 1 for every 1 across |
| 0.5 | Gentle, rising | Rises 1 for every 2 across |
| 0 | Flat | Same height everywhere |
| −1 | Falling at 45° | Drops 1 for every 1 across |
| Undefined | Vertical | Same x value for both points |
Slope in everyday life
Slope appears in many real places. For example, road builders use a percent grade, which is the slope multiplied by 100. A 5% grade rises 5 metres for every 100 metres along the road.
Ramps follow a similar rule. Many accessibility standards, including the ADA in the United States, set a maximum ramp slope of 1 in 12, which is about 8.3%. Check the rules in your area before you build one.
Slope also describes money and data. A rate of change on a graph, such as cost against hours, has a slope that shows how fast the cost grows. To find the length of the line itself, use the distance calculator. For a curve instead of a straight line, the quadratic formula calculator finds the turning point of a parabola.
Tips for reading a slope
Small sign errors are the most common mistake. These checks help you spot them:
- Keep the order the same. Take both x values and both y values from the same point order.
- Watch the signs. A negative number minus another negative number needs care.
- Check the direction. A rising line should have a positive slope when you read left to right.
- Use the equation to test a point. Put a known point into y = mx + b. It should be true.
- Compare the angle. The angle is the arctan of the slope, so a steeper line has a larger angle. To turn a slope into angles of a triangle, see the right triangle calculator.
The formula
Slope
m = (y₂ − y₁) ÷ (x₂ − x₁)
- m
- slope, the rise for each unit of run
Angle
θ = arctan(m)
- θ
- the angle the line makes with the x-axis, in degrees
Distance
d = √((x₂ − x₁)² + (y₂ − y₁)²)
- d
- straight-line distance between the two points
Equation of the line
y = mx + b, where b = y₁ − m × x₁
- b
- the y-intercept, where the line crosses the y-axis
Worked example
A line through (2, 3) and (6, 11)
- 1.Slope: (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2.
- 2.Intercept: b = 3 − 2 × 2 = −1.
- 3.Equation: y = 2x − 1.
- 4.Check with the second point: 2 × 6 − 1 = 11, which matches.
The line rises 2 units for every 1 unit across, and crosses the y-axis at −1.
Frequently asked questions
How do I find the slope of a line?
Divide the change in y by the change in x between two points on the line. For (2, 3) and (6, 11), the slope is 8 ÷ 4 = 2. Enter both points in the calculator to check.
What does an undefined slope mean?
The two points have the same x value, so the line is vertical. Dividing by a zero change in x is not possible, so the slope is undefined. Its equation is x = a constant.
What is a slope of zero?
A slope of zero means the line is horizontal. The two points have the same y value, and the equation is y = b.
Does it matter which point is first?
No. Swapping the two points changes the signs of both the rise and the run. The slope and the equation stay the same.
What is a 5% grade?
A 5% grade means the slope is 0.05. The road rises 5 units for every 100 units along it. Multiply the slope by 100 to get the percent grade.
Sources
Last reviewed by the GridCalculators team.