Slope Calculator
The slope of a line through two points is m = (y₂ − y₁) ÷ (x₂ − x₁), the rise over the run. Through (1, 2) and (5, 10) the slope is 2, the angle of inclination is 63.43°, the midpoint is (3, 6) and the line is y = 2x.
Last updated · By S. Dilshan · Runs in your browser, nothing is uploaded
Step-by-Step Solution
What Is the Slope of a Line?
Slope measures how steep a line is. It is the ratio of the vertical change (the rise) to the horizontal change (the run) between two points. A slope of 2 means the line climbs 2 units for every 1 unit it moves to the right. A negative slope means it falls, a slope of zero means it is flat, and a vertical line has an undefined slope because its run is zero.
Slope appears everywhere a rate of change matters: the grade of a road, the pitch of a roof, the speed shown on a distance–time graph, the gradient of a trend line in data. Once you know the slope and one point, you know the whole line.
Reading the Slope
| Slope m | Line behaviour | Example |
|---|---|---|
| Positive | Rises from left to right | (1, 2) to (5, 10): m = 2 |
| Negative | Falls from left to right | (0, 10) to (5, 0): m = −2 |
| Zero | Horizontal | y = 4 |
| Undefined | Vertical | (2, 3) to (2, 9) |
Slope Formulas
(x₁, y₁)and(x₂, y₂)are two distinct points on the line.mis the slope, andbis the y-intercept.- The angle of inclination is measured from the positive x-axis, between −90° and 90°.
- A grade of g% corresponds to a slope of g ÷ 100.
To write the line equation in other forms, use the point-slope form calculator. For lines parallel or perpendicular to a given one, use the parallel and perpendicular line calculator.
How Is It Calculated? Worked Examples
(1, 2) and (5, 10)
- Rise: 10 − 2 = 8. Run: 5 − 1 = 4.
- Slope: m = 8 ÷ 4 = 2.
- Angle of inclination: arctan(2) = 63.43°.
- Midpoint: ((1 + 5) ÷ 2, (2 + 10) ÷ 2) = (3, 6).
- Intercept: b = 2 − 2 × 1 = 0, so the line is y = 2x.
A Falling Line: (0, 10) and (5, 0)
m = (0 − 10) ÷ (5 − 0) = −2, an angle of −63.43°, and the line is y = −2x + 10.
A Vertical Line: (2, 3) and (2, 9)
The run is 0, so the slope is undefined. The line is simply x = 2.
Road Grades and Roof Pitch
| Situation | Slope | Angle |
|---|---|---|
| Road rising 5 m over 100 m (5% grade) | 0.05 | 2.86° |
| 10% grade | 0.10 | 5.71° |
| Wheelchair ramp 1 : 12 | 0.083 | 4.76° |
| Roof pitch 6 : 12 | 0.5 | 26.57° |
| 45-degree line (100% grade) | 1 | 45° |
Slope as a Rate of Change
If the temperature is 15 °C at 0 hours and 23 °C at 4 hours, the slope is (23 − 15) ÷ 4 = 2 °C per hour. If a delivery costs 30 for 10 units and 70 for 30 units, the slope is (70 − 30) ÷ 20 = 2 per unit and the intercept is 10, a fixed charge. In any real-world line, the slope carries the units of y divided by the units of x.
How to Use This Slope Calculator
- Enter the coordinates of the first point (x₁, y₁).
- Enter the coordinates of the second point (x₂, y₂).
- Read the slope, the angle of inclination, the midpoint and the equation of the line.
- If the x-coordinates are equal, the calculator reports that the line is vertical and the slope is undefined.
Where Slope Is Used
- Civil engineering and construction: road gradients, drainage falls, ramps and roof pitch.
- Physics: velocity is the slope of a position–time graph, and acceleration is the slope of a velocity–time graph.
- Economics and statistics: the slope of a trend line gives the rate of change.
- Cartography and hiking: steepness of terrain from contour lines.
- Calculus: the derivative is the slope of a curve at a point.
What Are the Most Common Mistakes With the Slope Calculator?
- Subtracting in inconsistent order. Use (y₂ − y₁) over (x₂ − x₁), both from the same point order.
- Inverting the ratio. Slope is rise over run, not run over rise.
- Dividing by zero. Vertical lines have no defined slope.
- Confusing slope with angle. A slope of 1 is 45°, not 1°.
- Mixing percent grade and slope. A 5% grade is a slope of 0.05.
- Using it for curves. A straight-line slope between two points on a curve is only an average.
Where Can You Verify These Formulas?
The definitions and formulas on this page follow standard references. Check them against these sources:
Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.
Frequently Asked Questions
What is the slope formula?
m = (y₂ − y₁) ÷ (x₂ − x₁), the change in y divided by the change in x.
What is the slope between (1, 2) and (5, 10)?
2, because the rise is 8 and the run is 4.
What is the slope of a vertical line?
It is undefined, because the run is zero and you cannot divide by zero.
How do I convert a slope to an angle?
θ = arctan(m). A slope of 2 corresponds to 63.43°.
How do parallel and perpendicular lines relate to slope?
Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1.
What does a slope of 0.05 mean?
The line rises 5 units for every 100 units of horizontal distance, a 5% grade or about 2.86°.