Slope Calculator
Calculators · Added
Two points fix a line, and everything else about it follows: how steep it is, which way it leans, how far apart the points are, where the middle sits, where it crosses each axis and what its equation looks like in each of the three forms a textbook asks for. Enter four coordinates and this works all of it out, including the vertical case where the slope does not exist at all.
How to use the slope calculator
- 1Enter the first point as x₁ and y₁. Negative numbers and decimals are both fine.
- 2Enter the second point as x₂ and y₂.
- 3Press Calculate.
- 4Read the slope at the top — shown as an exact fraction when the coordinates are whole numbers, because 3/4 is more useful than 0.75.
- 5The table underneath gives the equation in slope-intercept, point-slope and standard form; the rows below it give the intercepts and the slopes of any parallel or perpendicular line.
Examples
A rising line
- Input
- (1, 2) and (4, 8)
- Result
- Slope 2, angle 63.43°, distance 6.708, midpoint (2.5, 5), y = 2x
Rise 6 over run 3. The line happens to pass through the origin, so the y-intercept is zero and the equation loses its constant term.
A falling line with a fractional slope
- Input
- (-2, 5) and (3, -5)
- Result
- Slope -2, angle -63.43°, distance 11.18, standard form 2x + y = 1
A negative slope means the line falls as you read left to right. The angle is negative for the same reason.
The vertical case
- Input
- (3, -1) and (3, 6)
- Result
- Slope undefined, equation x = 3, distance 7, no y-intercept
The run is zero, so the division cannot be done. The line still has a length, a midpoint and an equation — which is why this returns them rather than an error.
About the slope calculator
What slope actually measures
Slope is a rate: how much the line climbs for each unit it travels sideways. A slope of 2 means two units up for every one along, and a slope of 0.02 means the same journey gains two hundredths of a unit — the difference between a staircase and a wheelchair ramp. Because it is a ratio rather than a length, it does not change when you slide along the line or scale the drawing, which is what makes it the natural way to describe steepness.
The sign carries the direction, and reading it is a matter of convention: lines are read left to right, so a positive slope rises and a negative slope falls. A slope of zero is a horizontal line — it runs without rising. The absent case is a vertical line, which rises without running, and which has no slope rather than an enormous one.
The same quantity appears under other names elsewhere on this site and in the world. A road sign showing 12% is a slope of 0.12 expressed as a percentage. A roof described as 6/12 is a slope of 0.5. The angle of inclination is the arctangent of the same number. All four are shown here together for that reason: which one you want depends entirely on who you are talking to.
The vertical line, and why it is the interesting case
Almost every slope calculator handles two points fine until the two share an x coordinate, at which point a good many of them display Infinity, NaN, or an empty box. None of those is the answer. The mathematics is unambiguous: the run is zero, division by zero is undefined, and so the slope is undefined.
What matters is that undefined slope does not mean undefined line. The line through (3, −1) and (3, 6) is perfectly well described — it is every point whose x coordinate is 3, its equation is x = 3, the distance between the two points is 7, the midpoint is (3, 2.5), and it crosses the x-axis at 3. All of that is computed and shown here, with only the slope, the point-slope form and the y-intercept reported as absent, because those are the only three things that genuinely do not exist.
This is also why the standard form is worth knowing. Ax + By = C can express a vertical line as 1x + 0y = 3, while y = mx + b cannot express it at all — there is no value of m that works. A form that covers every case is more useful than one that covers the common cases and fails silently on the rest, which is the same principle that governs how this page reports its results.
Frequently asked questions
Why is the slope undefined rather than infinite?
What is the difference between the three equation forms?
Why is the slope shown as a fraction sometimes and a decimal other times?
How do I get the slope of a perpendicular line?
Is the distance the same as the difference in the coordinates?
Related tools
Triangle Calculator
Calculators
Solve a triangle from any three parts — sides, angles, area, altitudes and the ambiguous case.
Quadratic Equation Solver
Calculators
Solve ax² + bx + c = 0 with roots, discriminant, vertex and factored form.
Roof Pitch Calculator
Calculators
Convert between rise-in-12, degrees and percent, and get rafter lengths and true roof area.