Find the slope of a line from two points or a point and slope, with the line equation in three forms, the angle, grade, intercepts and full working.
Working
Slope m = (y₂ − y₁) ÷ (x₂ − x₁). Fractions such as 3/4 are accepted. Exact fractions are shown when the inputs are whole numbers or simple fractions.
A slope calculator finds the slope of a line from two points using m = (y₂ − y₁) ÷ (x₂ − x₁), and gives the equation of the line in slope-intercept, point-slope and standard form. It also shows the angle of the line, the grade as a percentage, the distance and midpoint between the points, both intercepts and the perpendicular slope. You can also start from one point and a known slope.
For example, the line through (1, 2) and (4, 8) has a slope of 2 and the equation y = 2x. The line through (2, 3) and (6, 6) has a slope of 3/4, or 0.75, and the equation y = (3/4)x + 3/2.
Slope measures how steep a line is. It’s the ratio of the vertical change, called the rise, to the horizontal change, called the run, between any two points on the line. A slope of 2 means the line goes up 2 units for every 1 unit it moves to the right. A slope of −1/2 means it goes down 1 unit for every 2 units to the right.
Because a straight line has the same steepness everywhere, any two points on it give the same slope. That’s what makes slope useful: one number describes the direction and steepness of the whole line.
m = (y₂ − y₁) ÷ (x₂ − x₁)
Here (x₁, y₁) and (x₂, y₂) are two points on the line, and m is the slope. The letter m is the traditional symbol for slope. The order of the points doesn’t matter, as long as you subtract in the same order on the top and the bottom: (y₁ − y₂) ÷ (x₁ − x₂) gives the same answer.
| Slope | Direction of the line | Example |
|---|---|---|
| Positive | Rises from left to right | y = 2x |
| Negative | Falls from left to right | y = −x + 3 |
| Zero | Horizontal | y = 5 |
| Undefined | Vertical | x = 2 |
A vertical line has an undefined slope because the run is zero, and dividing by zero is impossible. Its equation is written as x = a constant instead of y = mx + b.
Find the slope through (2, 3) and (6, 6). The rise is 6 − 3 = 3 and the run is 6 − 2 = 4, so m = 3/4 = 0.75. The distance between the points is √(4² + 3²) = √25 = 5, and the midpoint is (4, 4.5).
For (−1, 4) and (3, −4), the rise is −4 − 4 = −8 and the run is 3 − (−1) = 4, so m = −8 ÷ 4 = −2. The line falls 2 units for every unit to the right, and its equation is y = −2x + 2.
A line passes through (2, −3) with slope 3/4. In point-slope form, it’s y + 3 = (3/4)(x − 2). Solving for y gives y = (3/4)x − 9/2, so the y-intercept is −4.5. Multiplying through by 4 gives the standard form 3x − 4y = 18.
To find b, substitute a known point into y = mx + b: b = y₁ − m × x₁. For the line through (1, 2) with slope 2, b = 2 − 2 × 1 = 0, so the line passes through the origin.
Slope is closely linked to the angle a line makes with the horizontal. The angle θ satisfies tan θ = m, so θ = arctan(m). A slope of 1 is a 45° angle, a slope of 0.5 is about 26.6°, and a slope of 2 is about 63.4°.
Engineers and builders often express slope as a grade, which is the slope multiplied by 100 and written as a percentage. A road with an 8% grade rises 8 metres for every 100 metres of horizontal distance, an angle of about 4.6°. Roof pitch is usually written as rise over a run of 12, so a 6/12 roof has a slope of 0.5. Wheelchair ramps are often limited to a slope of 1:12, a grade of about 8.3% or an angle of about 4.8°.
| Slope | Grade | Angle |
|---|---|---|
| 1/12 | 8.33% | 4.76° |
| 0.5 | 50% | 26.57° |
| 1 | 100% | 45° |
| 2 | 200% | 63.43° |
Parallel lines have the same slope, so they never meet. Perpendicular lines meet at a right angle, and their slopes are negative reciprocals: if one line has slope m, a perpendicular line has slope −1/m. The product of the two slopes is −1. For example, a line with slope 3/4 is perpendicular to any line with slope −4/3. A horizontal line, with slope 0, is perpendicular to a vertical line.
Outside geometry, slope describes how fast one quantity changes compared with another. On a distance–time graph, the slope is the speed. On a cost graph, it’s the cost per item. If a taxi charges a fixed fee plus a price per kilometre, the price per kilometre is the slope of the line and the fixed fee is the y-intercept. In science, the slope of a line of best fit often gives an important constant, such as the spring constant in a force–extension graph.
The y-intercept is where the line crosses the y-axis, at x = 0, and equals b in y = mx + b. The x-intercept is where the line crosses the x-axis, at y = 0. Setting y to zero gives x = −b ÷ m. For y = −2x + 2, the y-intercept is (0, 2) and the x-intercept is (1, 0). A horizontal line other than y = 0 has no x-intercept, because it never meets the x-axis.
Two other tools work well alongside this one: the quadratic formula calculator, to solve quadratic equations, and the distance calculator, to find the distance between two points.
Subtract the y-values and divide by the difference of the x-values: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (4, 8), m = 6 ÷ 3 = 2.
The line is horizontal. The y-value stays the same as x changes, so the equation has the form y = a constant.
A vertical line has an undefined slope because the run is zero and you can't divide by zero. Its equation is x = a constant.
Take the arctangent: angle = arctan(m). A slope of 1 gives 45°, and a slope of 0.5 gives about 26.6°.
The negative reciprocal, −1/m. A line with slope 2 is perpendicular to lines with slope −1/2.
Find the slope m, then the y-intercept b = y₁ − m × x₁, and write y = mx + b. The calculator does both steps for you.
No, as long as you subtract in the same order on the top and the bottom. Both orders give the same slope.
Grade is the slope written as a percentage. A slope of 0.08 is an 8% grade.
The slope is 3, the number in front of x. The y-intercept is 5.
Yes. Enter values such as 1/2 or −3/4. The calculator shows exact fractional slopes and equations where possible.
It means one quantity falls as the other rises, such as the value of a car going down as its age goes up.
It sets roof pitch, drainage falls, ramp steepness and road grades, usually written as a ratio or a percentage.