Slope & Line Equation Calculator

Find the slope, equation, length and angle of a line from two points.

x₁
y₁
x₂
y₂
Slope (m)
Equation
y-intercept (b)
Distance
Angle from horizontal

A vertical line (equal x values) has an undefined slope and the equation x = a constant.

Rise over run

The slope measures how steeply a line climbs or falls: the change in y divided by the change in x between two points on it. From the slope and one point, the whole line is determined.

m = (y₂ − y₁) ÷ (x₂ − x₁) · y = mx + b

Once you have the slope, the y-intercept follows by extending the line back to where x is zero. The calculator also reports the straight-line distance between the points and the angle the line makes with the horizontal.

Worked example

Through the points (1, 2) and (3, 8), the slope is 3 and the line is y = 3x − 1. The two points are about 6.32 units apart, and the line rises at roughly 71.6° from horizontal.

Reading a line

Slope is everywhere lines describe change: speed on a distance-time graph, cost per unit, the pitch of a ramp or roof. A clear equation lets you predict any point on the line, not just the two you started with.

Good to remember

  • Sign tells direction. Positive rises, negative falls, zero is flat.
  • Vertical is special. Equal x values mean an undefined slope.
  • Parallel and perpendicular. Parallel lines share a slope; perpendicular slopes multiply to −1.

Frequently asked questions

How is slope calculated?
Slope is rise over run: the change in y divided by the change in x between the two points. A positive slope rises left to right; a negative one falls.
What does an undefined slope mean?
When both points share the same x value the line is vertical, the run is zero, and division is impossible — so the slope is undefined. Its equation is x = a constant.
What is the y-intercept?
It is where the line crosses the y-axis, found by extending the line to x = 0. In the equation y = mx + b, it is the value b.
How is the angle found?
The angle from horizontal is the inverse tangent of the slope. A slope of 1 is 45°; steeper slopes approach 90°; a slope of 0 is flat.