Skip to main content

How to Find the Slope Between Two Points (Plus Angle, Distance, and Line Equation)

A practical guide to the slope formula: turn two points into slope, angle of inclination, distance, midpoint, and the y = mx + b line equation, with a worked example.

Published By 李雷
#slope #geometry #math #calculator #coordinate-geometry

How to Find the Slope Between Two Points (Plus Angle, Distance, and Line Equation)

Two points define a line, and that single line carries more information than most people pull out of it. You can read its slope, the angle it makes with the horizontal, the distance between the points, the midpoint, and the full equation y = mx + b. Most homework problems and field measurements ask for just one of these, but they all come from the same two coordinates. This guide walks through how each value is derived, runs a real example, and shows where the math actually shows up outside the classroom.

The slope formula: rise over run

Slope measures how steeply a line climbs or falls. The formula is:

m = (y2 - y1) / (x2 - x1)

The numerator is the rise — the vertical change, written Δy. The denominator is the run — the horizontal change, Δx. Dividing the two tells you how many units y moves for every single unit of x.

Take the points (1, 2) and (4, 11). The rise is 11 - 2 = 9, the run is 4 - 1 = 3, so the slope is 9 / 3 = 3. A positive slope climbs from left to right, a negative slope falls, and a slope of 0 is a flat horizontal line.

The most common mistake here is subtracting inconsistently. If you compute y2 - y1 on top but x1 - x2 on the bottom, you flip the sign and get a wrong answer that still looks reasonable. Always subtract both coordinates in the same order. When I grade slope problems, a flipped sign from inconsistent subtraction is the single error I see more than any other — it sneaks past you because the magnitude is right.

When the slope is undefined

There is one case the rise-over-run formula cannot handle: a vertical line. Every point on a vertical line shares the same x value, so for two points on it x2 = x1 and the run Δx is 0. The formula then asks you to divide by zero, which has no real value. That is why we say a vertical line's slope is undefined — not infinite, and definitely not zero.

Example: (3, 1) and (3, 8) have a run of 0 and a rise of 7. This is a vertical line, and its equation is written x = 3, not y = mx + b. A good slope calculator prints "undefined (vertical line)" here instead of returning a misleading Infinity or NaN. Calling a vertical line's slope "zero" is a classic trap — zero is a horizontal line, the exact opposite.

From slope to angle of inclination

The slope is a ratio, but sometimes you want the actual angle the line makes with the horizontal. That angle is the arctangent of the slope:

angle = atan2(Δy, Δx)   (in degrees)

A slope of 1 makes a 45-degree angle, because the rise equals the run. A slope of 0 is 0 degrees (flat), and a vertical line sits at 90 degrees. For the points (0, 0) and (1, 1.732), the slope is about 1.732, and atan(1.732) works out to almost exactly 60 degrees.

Using atan2(Δy, Δx) rather than a plain atan(m) keeps the angle correct in all four quadrants — including lines pointing straight down or to the left, where a naive arctangent collapses direction information. If you are working through the inverse trig by hand, a dedicated trigonometry calculator will confirm the atan value without you reaching for a slide rule of mental tables.

Distance, midpoint, and the line equation

The same two points hand you three more results for free.

Distance between the points uses the Pythagorean theorem: distance = hypot(Δx, Δy) = √(Δx² + Δy²). This is the true straight-line length, not the horizontal span.

Midpoint is the average of the coordinates: ((x1 + x2) / 2, (y1 + y2) / 2).

The line equation is where slope pays off. Slope-intercept form is y = mx + b, where b is the y-intercept — the y value where the line crosses x = 0. Once you know m and one point, you can solve for b. Point-slope form, y - y1 = m(x - x1), describes the same line and is handy when you have a slope and a point but no intercept yet.

For slope m = 3 through (1, 2): point-slope is y - 2 = 3(x - 1), and expanding gives y = 3x - 1, so the intercept b is -1. The tricky part is formatting — handling b = 0, m = 1, and m = -1 so the equation reads cleanly rather than as y = 1x + -1.

A worked example, start to finish

Here is a full run with a real homework-style input. The worksheet asks for the line through (-2, 3) and (4, -9). Typing those two points into the slope calculator returns the complete picture at once:

  • Slope: m = (-9 - 3) / (4 - (-2)) = -12 / 6 = -2
  • Angle: atan2(-12, 6) ≈ -63.43° — falling steeply left to right
  • Distance: √(6² + 12²) = √180 ≈ 13.42
  • Midpoint: ((-2 + 4) / 2, (3 + -9) / 2) = (1, -3)
  • Equation: y = -2x - 1
  • Grade: m × 100 = -200%

Every one of those derives from the same two coordinates. Instead of re-deriving rise over run by hand and second-guessing a sign, you see all the related quantities together and can check that your written work matches before you turn it in. That is the whole point: one input, the full set of answers, cross-checkable in a glance.

Grade percentage and real-world use

Outside the classroom, slope shows up as grade percentage — the slope times 100. A slope of 0.05 is a 5% grade, meaning the surface rises 5 units of height for every 100 units of horizontal distance. Civil engineers read it off two survey points along a road centerline: enter horizontal station as x and elevation as y, and the grade drops straight out. A 6% stretch may already flag as too steep for a design standard.

The numbers carry real safety meaning. Under the ADA, a wheelchair ramp is capped at a slope of 1:12 — about an 8.33% grade — for accessible routes (U.S. Access Board, ADA Standards §405). One subtle catch: grade percentage is not the same as the angle in degrees. A 100% grade is a 45-degree slope, not 90, because grade measures rise over horizontal run while the angle is measured off the horizontal. Reading "10% grade" as "10 degrees" overstates steep slopes and understates shallow ones.

Whether you are checking a homework sign, finding the equation of a trend line for a report, or sizing a ramp to a code limit, the workflow is identical: drop in two points, read the slope, angle, distance, and equation, and trust that the vertical-line and edge cases are handled honestly. Everything runs locally in your browser, and the share link rebuilds your exact two points.


Made by Toolora · Updated 2026-06-13