Slope Calculator

Enter the coordinates of two points and this calculator gives you the slope of the line through them, plus the y-intercept, the full equation y = mx + b, and the angle of incline in degrees.

Put this calculator on your website for free

Copy one snippet and give your visitors a working Slope Calculator.

How the slope calculator works

Slope measures how steep a line is: how much it rises (or falls) for every unit it moves to the right. Given two points, the calculator divides the change in y by the change in x, the classic rise over run. From the slope it then back-solves the y-intercept, writes out the full line equation, and converts the slope to an angle in degrees.

The formula

m = (y₂ − y₁) ÷ (x₂ − x₁)

m is the slope, and (x₁, y₁) and (x₂, y₂) are your two points. The y-intercept follows as b = y₁ − m·x₁, and the angle of incline is arctan(m).

Worked example

Take the points (2, 3) and (6, 11):

m = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2

b = 3 − 2 × 2 = −1, so the line is y = 2x − 1, climbing at an angle of arctan(2) ≈ 63.43°. In plain terms: for every step right, the line rises two.

The one mistake everyone makes

Mixing up the subtraction order. It doesn't matter which point you call "point 1," but you must subtract in the same order on top and bottom. (11 − 3)/(6 − 2) and (3 − 11)/(2 − 6) both give 2, but (11 − 3)/(2 − 6) gives −2 and silently flips your line upside down. If your slope's sign surprises you, check the order first. And remember the two special cases: same y-values means slope 0 (horizontal), same x-values means the slope is undefined (vertical), not zero.

Frequently asked questions

How do I find the slope between two points?

Subtract the y-coordinates, subtract the x-coordinates, and divide: slope = (y2 − y1) ÷ (x2 − x1). This is the famous "rise over run": how much the line goes up (or down) for every unit it moves to the right.

What does an undefined slope mean?

If both points have the same x-coordinate, the line is perfectly vertical and the run is zero. Dividing by zero is undefined, so vertical lines have no slope. They're written as x = a constant instead of y = mx + b.

What does a slope of 0 mean?

A slope of 0 means the line is perfectly horizontal: the y-value never changes no matter how far you travel along x. Its equation is simply y = b, where b is the shared y-coordinate of every point on the line.

How do I find the y-intercept from two points?

First compute the slope m, then plug either point into b = y − m·x. The y-intercept is where the line crosses the y-axis, i.e. the value of y when x = 0. This calculator does both steps for you automatically.

How is slope related to the angle of a line?

The slope is the tangent of the line's angle with the horizontal axis, so angle = arctan(slope). A slope of 1 is a 45° incline, a slope of 2 is about 63.4°, and negative slopes give negative angles (the line goes downhill left to right).

Related calculators