Slope Calculator

Enter two points to calculate slope and intercepts, or supply a line in Ax + By = C form. Vertical and horizontal lines are handled explicitly, with a schematic of the line direction.

Points mode uses the four coordinates. Equation mode uses A, B and C only.

How the calculation works

For two points, m = (y₂ − y₁) / (x₂ − x₁). The y-intercept is y₁ − mx₁. For Ax + By = C and B ≠ 0, m = −A/B and the y-intercept is C/B. Distance = √(Δx² + Δy²).

Worked example

Points (1,2) and (3,6) have Δx=2 and Δy=4, so slope=2 and the line is y=2x. Distance is √20, approximately 4.472. Points with the same x define a vertical line.

Assumptions and limitations

Each coordinate or coefficient is between −10¹² and 10¹². Coincident points do not define a unique line. A and B cannot both be zero. Display uses up to 12 significant digits and floating-point arithmetic.

Slope is signed rise divided by run. A vertical line has undefined slope, not zero slope. The schematic centers on an intercept and is not a scaled survey, building design or substitute for measured coordinates.

Method reviewed 2026-10-13. Calculation standards · Report an issue