Slope Calculator
Last updated: November 4, 2026
Find the slope and equation through two Cartesian points, including vertical lines.
On this page
Quick summary: Find the slope and equation through two Cartesian points, including vertical lines.
Read the complete guide
Updated reference sections in this guide are in English.
Using this calculator
Enter two distinct points using the same coordinate system. The first pair is (x₁, y₁) and the second is (x₂, y₂). A horizontal change and vertical change are reported so you can see the direction and denominator used. Reversing both endpoints leaves the slope unchanged.
Calculation method
Slope m = Δy / Δx when Δx ≠ 0
Intercept b = y₁ − mx₁
Line: y = mx + b
When Δx is zero and Δy is nonzero, the line is vertical and is written x = x₁. Its slope is undefined, so the result does not assign it a very large number. Identical endpoints are rejected because infinitely many lines pass through a single point.
Worked examples
An increasing line
For (0, 0) and (3, 4), the rise is 4 and the run is 3. Slope is 4/3 ≈ 1.333333333333, and the y-intercept is zero.
Vertical and horizontal cases
(2, 1) and (2, 9) define x = 2. Points (1, 5) and (7, 5) instead define a horizontal line with slope 0 and equation y = 5.
Check this scenario in the calculator:
- First x coordinate
- 0
- First y coordinate
- 0
- Second x coordinate
- 3
- Second y coordinate
- 4
Understanding the result
Slope has units of vertical measurement per horizontal measurement. On axes with the same physical scale, it describes geometric steepness. If the axes represent different quantities or use different scales, a visual angle on a chart is not itself the numeric slope.
Boundaries and assumptions
Coordinates must be finite and within ±10¹². Extremely close x coordinates can produce a large slope; results beyond the supported numeric range are rejected. This calculation gives the line through two supplied points, not a regression fit or a causal relationship between measured variables.
Questions and reference
Is a vertical slope zero?
No. Zero slope is horizontal. A vertical line has no finite slope.
Does the order of the points matter?
Reversing both points changes the signs of rise and run together, leaving their ratio unchanged.
Reference: OpenStax: rectangular coordinates and graphs.