Slope Calculator
Calculate slope, y-intercept, line equation, distance, and midpoint from two points.
Find the slope, y-intercept, line equation, distance, and midpoint between two points, or work with a slope derived from an angle or a parallel/perpendicular relationship.
How Slope Calculator Works
Given two points, slope is calculated as "rise over run": m = (y₂ − y₁) / (x₂ − x₁). Once the slope is known, the y-intercept follows from b = y₁ − m×x₁, giving the full line equation in the familiar y = mx + b form.
The calculator also reports the straight-line distance between the two points (using the distance formula, derived from the Pythagorean theorem) and their midpoint (the average of each pair of coordinates), plus the line's angle from horizontal, found by taking the arctangent of the slope.
In "From Angle" mode, a slope is generated directly from an angle using tan(angle) — since slope is, by definition, the tangent of the angle a line makes with the horizontal. In "Parallel/Perpendicular" mode, entering a known slope instantly gives the parallel slope (identical value) and the perpendicular slope (its negative reciprocal, −1/m).
See It In Action
Who Uses Slope Calculator and Why
- Finding the equation of a line through two data points for an algebra or coordinate geometry assignment.
- Computing a roof pitch or grade as a rise-over-run slope from two measured points.
- Checking whether two lines are parallel or determining the exact perpendicular slope for a fence or wall layout.
- Getting the straight-line distance and midpoint between two coordinates alongside the slope calculation.
Mistakes to Avoid
- Swapping the rise and run — computing (x₂−x₁)/(y₂−y₁) instead of (y₂−y₁)/(x₂−x₁) — which inverts the slope value.
- Expecting a defined slope when both points share the same x-coordinate — that describes a vertical line, where the run is zero and slope is mathematically undefined.
- Entering a raw slope value into the 'From Angle' mode's angle field, or vice versa — the two modes expect different kinds of input (a degree measure versus a plain ratio).
Tips for Best Results
- An 'Undefined' slope result is a strong signal that your two points share an x-coordinate (a vertical line) — it's not a calculation error.
- Use Parallel/Perpendicular mode to get the negative reciprocal instantly instead of computing −1/m by hand.
Fixing Common Problems
The slope shows as 'Undefined'. — This happens when both points share the same x-coordinate, producing a vertical line — since the run (change in x) is zero, dividing by it has no defined value.
Terms Explained
Y-intercept: The point where a line crosses the y-axis, found as b = y₁ − m×x₁ once the slope is known.
Negative reciprocal: The value −1/m of a given slope m, which describes the slope of any line perpendicular to it.