Slope Calculator

Enter the coordinates of two points to get the slope (rise over run), the line's equation in y = mx + b form, the angle it makes with the horizontal, the distance between the points and their midpoint.

Enter two points, then press Calculate slope.

The slope formula

The slope of a line measures how steep it is — how much y changes for each unit of change in x. From two points (x₁, y₁) and (x₂, y₂), it's the rise divided by the run.

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

Once you have the slope m, the line's equation in slope-intercept form is y = mx + b, where the y-intercept b = y₁ − m·x₁. The angle the line makes with the horizontal is arctan(m), converted to degrees.

Worked example

For the points (1, 2) and (4, 8):

Rise: 8 − 2 = 6.
Run: 4 − 1 = 3.
Slope: 6 ÷ 3 = 2, so the line is y = 2x + 0 (it passes through the origin's direction with b = 0).

Special cases

A positive slope rises left-to-right; a negative slope falls. A slope of 0 is a horizontal line (y = constant). When x₁ = x₂ the run is zero, the slope is undefined, and the line is vertical (x = constant) — the calculator reports this rather than dividing by zero. The distance between the points uses the Pythagorean theorem, √((x₂−x₁)² + (y₂−y₁)²).

Tip: solving a curve instead of a line? Try the quadratic equation solver, or work out ratios with the ratio calculator.

Frequently asked questions

What does the slope mean?

Slope m is the rate of change of y with respect to x — the rise over the run. A slope of 2 means y goes up 2 for every 1 it moves right; a slope of −0.5 means y falls half a unit per unit right.

Why is my slope undefined?

Because the two points share the same x-value, making the run (x₂ − x₁) zero. Division by zero is undefined, so the line is vertical and written as x = constant rather than y = mx + b.

How do I get the y-intercept?

Once you know the slope m, the intercept is b = y₁ − m·x₁. The calculator plugs in your first point to find where the line crosses the y-axis and shows the full y = mx + b equation.

What is the angle of the line?

It's the angle the line makes with the horizontal x-axis, equal to arctan(slope) in degrees. A 45° angle corresponds to a slope of 1; steeper lines have larger angles.

MB
Mustafa Bilgic · Editor, Calcool
Uses the standard slope formula (rise ÷ run), slope-intercept form and the distance formula from coordinate geometry. Everything runs in your browser — nothing you enter is uploaded, logged or stored.

Related calculators