Slope Calculator

Enter two points to find the slope of the line through them, the equation of the line, the angle and the distance.

The x coordinate of the first point.

The y coordinate of the first point.

The x coordinate of the second point.

The y coordinate of the second point.

This result is an estimate only. Double-check important figures before relying on them.

How it is calculated

  • Slope m = (y₂ − y₁) ÷ (x₂ − x₁)
  • y-intercept b = y₁ − m × x₁, giving the line y = mx + b
  • Angle = the arctangent of m, in degrees
  • Distance = √((x₂ − x₁)² + (y₂ − y₁)²)
  • Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

For the sides of a right triangle, use the Pythagorean theorem calculator. For other maths, use the scientific calculator.

Worked example

The points (1, 2) and (3, 6):

  • Slope: (6 − 2) ÷ (3 − 1) = 2
  • Intercept: 2 − 2 × 1 = 0, so the line is y = 2x
  • Angle: arctan(2) = 63.43°
  • Distance: √(4 + 16) = 4.4721, and the midpoint is (2, 4)

Why your number may differ

Results are rounded to four decimal places, and the equation to six. The slope of a road or roof is often given as a percentage, which is the slope times 100.

Frequently asked questions

How do you find the slope between two points?

Slope m = (y₂ − y₁) ÷ (x₂ − x₁), the rise divided by the run. A positive slope goes up to the right, and a negative slope goes down.

What is the equation of the line?

y = mx + b, where m is the slope and b is where the line crosses the y-axis. b = y₁ − m × x₁.

Why is a vertical line undefined?

On a vertical line x₂ − x₁ is 0, and dividing by 0 is not possible. Its equation is simply x = a number.