Advertisement

Slope calculator

Enter two points on the line. The slope and its angle from the x axis update as you type.

Calculator

The two points cannot share the same x value: a vertical line has no defined slope.

Slope m
2.000000
Angle from the x axis (degrees)
63.434949

Advertisement

How this calculator works

The slope measures how steeply a line rises or falls: it is the change in y divided by the change in x between any two points on the line. Positive slopes rise to the right, negative slopes fall, and a horizontal line has slope 0. The associated angle comes from the arctangent of the slope and always lands between -90° and 90°.

Formula

m = (y₂ - y₁) / (x₂ - x₁) and θ = arctan(m) in degrees, with θ in (-90°, 90°).

Worked example

For the points (1, 2) and (5, 10), m = (10 - 2)/(5 - 1) = 2, and θ = arctan(2) ≈ 63.4349°. For (0, 0) and (2, 5), m = 2.5 and θ ≈ 68.1986°.

Advertisement

Frequently asked questions

Why is a vertical line an error?

When both points share an x value the denominator x₂ - x₁ is zero, and division by zero has no defined result. Geometrically the line is vertical and its slope is undefined.

Can the slope be negative?

Yes. When y decreases as x increases, the slope is negative and the angle is reported between -90° and 0°.

Does the order of the points matter?

No. Swapping the two points reverses both differences, so the slope and angle are unchanged.

Sources

Advertisement