Free online calculator

Slope Calculator

Enter two distinct coordinate points to find slope, line equation, directed angle, grade and distance. Check the axis units: a rate such as dollars per hour is useful, but its angle is not a physical incline.

Slope
0.75
Line equation
y = 0.75x + 0
Angle
36.869898°
Grade
75%
Point distance
5
Rise / run
3 / 4

Slope and direction

  • m = (y₂ − y₁)/(x₂ − x₁), provided x₂ ≠ x₁.
  • The angle uses atan2(rise, run); reversing points changes direction while preserving slope.
  • A 1-in-2 rise has slope 0.5, grade 50%, and an acute inclination of about 26.565°.
  • Equal points do not define a line. Different points with equal x define a vertical line.

How to use the Slope Calculator

  1. Enter x₁, y₁, x₂ and y₂ for two distinct points.
  2. Compute run Δx = x₂ − x₁ and rise Δy = y₂ − y₁.
  3. For nonzero run, slope m = Δy/Δx and intercept b = y₁ − mx₁, giving y = mx + b.
  4. Distance is √(Δx² + Δy²). Grade is 100m when horizontal and vertical units are the same.
  5. The displayed angle is atan2(Δy, Δx) in degrees, retaining the direction from the first point to the second.
  6. For zero run, distinct points define a vertical line. Identical points instead show a no-unique-line notice; correct the coordinates before reading a direction.

A grade percentage is not a percentage of the path

Grade divides the vertical rise by horizontal run, not by the sloping length. A rise of 3 over a horizontal run of 4 is 75% grade, even though rise divided by path length is 3/5 = 60%. Those ratios use different denominators.

The acute inclination for a positive rise and run is arctan(slope). The tool instead displays atan2 for the ordered points, so reversing the points changes the angle's quadrant. Compare angles only after choosing a consistent direction.

Coordinate units and degenerate inputs

If x is measured in hours and y in dollars, slope has units dollars per hour. That is a useful rate, but the resulting angle and Euclidean distance have no direct physical meaning. For geometric distance, angle and grade, first express both axes in the same length unit and use an appropriate coordinate system.

Distinct points (2,1) and (2,5) define x = 2 with undefined slope. Repeating the same point now displays a no-unique-line notice. Empty or nonfinite coordinates are rejected.

A two-point grade calculation does not establish that a ramp, roof or road meets any construction requirement. It ignores surface irregularities and changes between points. Use surveyed measurements and the applicable design rules for a physical project.

Distinct points and compatible axes

Identical points do not determine a unique line. Distinct equal-x points define a vertical line with undefined slope. Grade is rise divided by horizontal run, not sloping distance. Empty or nonfinite coordinates are rejected.

Examples

Verify every output with a 3–4–5 triangle

From (0,0) to (4,3), run = 4, rise = 3, slope = 0.75 and intercept = 0. Distance = √(16 + 9) = 5, grade = 75% and angle ≈ 36.869898°. Substituting x = 4 into y = 0.75x returns y = 3.

A falling line with a nonzero intercept

From (2,7) to (6,5), rise = −2 and run = 4, so slope = −0.5. Intercept = 7 − (−0.5 × 2) = 8, giving y = −0.5x + 8. At x = 6, this yields 5; distance is √20 ≈ 4.472136 and angle ≈ −26.565051°.

Reversing the same segment

From (4,3) to (0,0), rise = −3 and run = −4, giving the same slope 0.75 and distance 5. The directed angle is about −143.130102°, rather than 36.869898°, because the direction has reversed by 180°.

Check the result in context

Vertical versus identical: (2,1) and (2,5) define x = 2 and distance 4. Repeating (2,1) gives distance 0 and no unique line or direction.

Slope, grade and angle

Rise:runSlopeGradeAngle
1:120.08338.33%4.76°
2:120.166716.67%9.46°
3:120.2525.00%14.04°
4:120.333333.33%18.43°
6:120.550.00%26.57°
8:120.666766.67%33.69°
12:121100.00%45.00°
1:11100.00%45.00°
1:20.550.00%26.57°

Frequently asked questions

Why can the angle change when slope does not?

Reversing points negates both rise and run, leaving their ratio unchanged. atan2 uses their signs to distinguish directions, so its angle changes by 180° modulo a full turn.

Can I combine feet on one axis and inches on the other?

Convert them to one unit before interpreting grade, angle or distance. A rise of 6 inches over 12 feet is 0.5/12 ≈ 0.041667, or 4.1667% grade, not 50%.

Is a vertical line the same as two identical points?

No. A vertical line requires two distinct points with the same x. One repeated point is compatible with infinitely many lines and does not define a slope or direction.

Why is 75% grade not 75 degrees?

A rise of 3 over run 4 gives 3/4 × 100 = 75% grade, but its angle is atan2(3,4) ≈ 36.869898°. Percent and degrees measure different quantities.

Sources & methodology

Related tools

More math tools