CalcDuck

Slope Calculator

Slope Calculator

Slope (m)
2
Y-intercept (b)
0
Line equation
y = 2x
Distance between points
4.4721
Midpoint
(2, 4)
Angle from horizontal (degrees)
63.43

The slope between two points is m = (y2 − y1) ÷ (x2 − x1). Between (1, 2) and (3, 6), the slope is (6 − 2) ÷ (3 − 1) = 2, giving the line equation y = 2x, since the line passes through the origin.

Tip: “Copy with settings” shares a link that opens this calculator with your numbers already filled in.

How this calculator works

Enter the coordinates of two points and this calculator finds the slope of the line through them, the full line equation in y = mx + b form, the straight-line distance between the points, their midpoint, and the angle the line makes with the horizontal axis.

Slope measures steepness: how much y changes for every unit change in x. A positive slope rises left to right, a negative slope falls, a slope of 0 is a flat horizontal line, and a vertical line has no defined slope at all because the change in x is zero and division by zero is undefined. This calculator reports that case explicitly rather than showing an error.

How do you calculate slope?

Slope: m = (y₂ − y₁) ÷ (x₂ − x₁)Line equation: y = mx + b, where b = y₁ − m·x₁Distance: d = √((x₂ − x₁)² + (y₂ − y₁)²)Midpoint: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)Angle from horizontal: θ = arctan(m), in degrees

Worked example: (0, 5) to (5, 0)

  1. Slope: m = (0 − 5) ÷ (5 − 0) = −5 ÷ 5 = −1.
  2. Y-intercept: b = 5 − (−1 × 0) = 5, so the line is y = −1x + 5.
  3. Distance: √((5−0)² + (0−5)²) = √50 ≈ 7.07.
  4. Midpoint: (2.5, 2.5); angle from horizontal: arctan(−1) = −45°.

Frequently asked questions

Why is a vertical line's slope undefined instead of zero?

Slope is a ratio of vertical change to horizontal change. On a vertical line the horizontal change (x₂ − x₁) is zero, and dividing by zero has no defined value, so the slope is undefined rather than 0. A horizontal line, by contrast, has a defined slope of exactly 0.

How do I read the sign of the slope?

A positive slope means the line rises as x increases; a negative slope means it falls. The larger the absolute value, the steeper the line — a slope of 5 is much steeper than a slope of 0.5.

What is the angle from horizontal used for?

It converts slope into a more intuitive degree measurement using arctan(m). A 45° angle corresponds to a slope of exactly 1 (or −1), while angles approach 90° as the line gets closer to vertical.

Does the order of the two points matter?

No. Swapping (x₁, y₁) and (x₂, y₂) flips the sign of both the numerator and denominator in the slope formula, so the slope, line equation, distance and midpoint all come out the same.

How do I find the line equation from one point and the slope?

Use point-slope form: plug the known slope m and the point's coordinates into y − y₁ = m(x − x₁), then simplify. This reaches the same y = mx + b form this calculator returns from two points, just starting from one point and the slope directly instead of a second point.

Sources

Related calculators