The slope formula
The slope of a line measures how steep it is: how much y changes for each one-unit step in x. For two points (x₁, y₁) and (x₂, y₂):
m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run
A positive slope rises from left to right, a negative slope falls, a slope of 0 is a horizontal line, and when x₂ = x₁ the run is zero, the division is undefined and the line is vertical. The order of the points does not matter as long as you subtract in the same order on top and bottom.
The angle of inclination is θ = arctan(m), measured counter-clockwise from the positive x-axis (0° to 180°). Multiply the slope by 100 to get the grade used for roads and ramps: m = 0.08 is an 8% grade.
Three ways to write the line
- Slope-intercept form y = mx + b, where b = y₁ − m·x₁ is where the line crosses the y-axis. Best for graphing and reading off the slope.
- Point-slope form y − y₁ = m(x − x₁). The quickest to write when you know one point and the slope.
- Standard form Ax + By = C with whole-number A, B, C, no common factor and A ≥ 0. It is the only form that also covers vertical lines (x = c).
The calculator also reports the distance between the points, d = √((x₂ − x₁)² + (y₂ − y₁)²), the midpoint ((x₁ + x₂)/2, (y₁ + y₂)/2), both intercepts and the slope of a perpendicular line, −1/m. All arithmetic is done with exact fractions, so 1/3 stays 1/3 instead of 0.333…, and distances are given as simplified radicals such as 6√5.
Worked example
Find the line through A(1, 2) and B(5, 5).
- Rise = 5 − 2 = 3, run = 5 − 1 = 4, so m = 3/4 (0.75).
- b = 2 − (3/4)(1) = 5/4, giving y = (3/4)x + 5/4.
- Point-slope: y − 2 = (3/4)(x − 1). Multiply by 4 and rearrange for standard form: 3x − 4y = −5.
- Distance: √(4² + 3²) = √25 = 5 (a 3-4-5 right triangle).
- Midpoint: ((1 + 5)/2, (2 + 5)/2) = (3, 7/2).
- Angle: arctan(0.75) = 36.87°; x-intercept −5/3, y-intercept 5/4.
Parallel and perpendicular lines
Parallel lines have equal slopes. Two non-vertical lines are perpendicular when their slopes multiply to −1, so a line perpendicular to one with slope 3/4 has slope −4/3. A horizontal line (m = 0) is perpendicular to a vertical line, whose slope is undefined. To find where two lines cross, write both in standard form and solve the pair with the system of equations solver.
Frequently asked questions
What is the slope of a vertical line?
It is undefined, because the run x₂ − x₁ is zero and you cannot divide by zero. Its equation is x = c, and its angle of inclination is 90°.
Can I enter fractions or decimals?
Yes. Enter values like 3/4, -1 1/2 or 0.25. They are converted to exact fractions, so the slope and equation come out exact.
How do I convert slope to an angle or a percent grade?
Angle = arctan(m) in degrees; grade = m × 100%. A slope of 1 is a 45° angle and a 100% grade.
Does it matter which point I call the first?
No. Swapping the points flips the sign of both the rise and the run, so their ratio — the slope — is unchanged.
Last reviewed: