FLXCode Slope Calculator

FLXCode apps

Appearance

Slope Calculator

Type two points. You get the slope as a fraction and a decimal, the angle, percent grade, distance, midpoint and the equation of the line.

ExampleType two points. Negatives and decimals work.

Done.

Slope m = 0.75

(3, 2)(7, 5)
Slope m
0.75
Rise and run
3 up, 4 across
Angle
36.8699° from the x-axis
Percent grade
75%
Line
y = 0.75x − 0.25
Perpendicular slope
-4/3 (-1.3333)
Distance
5
Midpoint
(5, 3.5)

The steps, with your numbers

  1. m = (y₂ − y₁) / (x₂ − x₁) = (5 − 2) / (7 − 3) = 3 / 4 = 0.75
  2. angle = arctan(m) = arctan(0.75) = 36.8699°
  3. b = y₁ − m × x₁ = 2 − 3/4 × 3 = -1/4
  4. distance = √((x₂ − x₁)² + (y₂ − y₁)²) = √(4² + 3²) = √25 = 5
  5. midpoint = ((x₁ + x₂) / 2, (y₁ + y₂) / 2) = ((3 + 7) / 2, (2 + 5) / 2) = (5, 3.5)

No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.

Problem or idea? Email us

The formula

m = (y₂ − y₁) / (x₂ − x₁)

Rise over run. The rest follows from m:

  • Angle from the horizontal: θ = arctan(m)
  • Percent grade: m × 100
  • Line equation: y = mx + b, with b = y₁ − m × x₁
  • Distance: √((x₂ − x₁)² + (y₂ − y₁)²)
  • Midpoint: ((x₁ + x₂) / 2, (y₁ + y₂) / 2)

Worked examples

LinePointsSlopeAngleEquationDistance
Rising(3, 2) to (7, 5)0.7536.8699°y = 0.75x − 0.255
Falling(-2, 4) to (2, -4)-2-63.4349°y = −2x4√5 ≈ 8.9443
Fraction(0, 0) to (3, 1)1/3 (0.3333)18.4349°y = (1/3)x√10 ≈ 3.1623
Flat(1, 3) to (9, 3)00°y = 38
Vertical(2, 1) to (2, 6)undefined (vertical line)90°x = 25
Decimals(0.5, 1.25) to (2.5, 3.25)145°y = x + 0.752√2 ≈ 2.8284

The distance in the first row is 5 because the rise 3 and run 4 make a 3-4-5 right triangle. See the Pythagorean theorem calculator for that step.

Slope, grade and angle side by side

Rise to runPercent gradeAngle
1:205%2.86°
1:128.33%4.76°
1:1010%5.71°
1:425%14.04°
1:250%26.57°
1:1100%45°

Percent grade and angle are not the same. Grade keeps climbing past 100% while the angle stops at 90°. For roofs, which use rise per 12 inches of run, use the roof pitch calculator. For stairs, see the stair calculator.

Numbers this uses

  • The steepest wheelchair ramp the US ADA Standards allow is 1:12, which is 8.33%, or 4.76° (ADA Standards 405.2).
  • The slope is computed on exact fractions. 1/3 stays 1/3, with 0.3333 beside it, so no rounding noise from decimals like 0.1.
  • Angles and the arctan step use the double-precision value of π that your browser has built in.
  • "Decimals" only rounds what is shown.
  • Values above 1,000,000,000,000 are rejected so the arithmetic stays accurate.

Limits

  • Two points on a flat plane. The units of x and y should match if you want the angle to mean something, such as feet and feet.
  • The angle is the line's angle from the x-axis, between −90° and 90°. A falling line gives a negative angle.
  • Identical points give an error, because many lines pass through one point.

Nothing you type is uploaded. We count events without cookies (details).

FAQ

How do I calculate the slope between two points?

Divide the rise by the run: m = (y₂ − y₁) / (x₂ − x₁). For (3, 2) and (7, 5), that is (5 − 2) / (7 − 3) = 3/4 = 0.75. The tool shows the fraction and the decimal, and the steps with your numbers.

What is the slope of a vertical line?

Undefined. Both points have the same x, so the run is 0 and you can not divide by zero. The line is written x = 3 (or whatever x is). The tool says "undefined (vertical line)" and gives the distance, midpoint and the perpendicular slope, which is 0.

What is the slope of a horizontal line?

Zero. Both points have the same y, so the rise is 0. The line is y = c, and its perpendicular line is vertical, with an undefined slope.

Does the order of the points matter?

No. Swapping the points flips both the rise and the run, so the signs cancel and the slope stays the same. Only keep each x with its own y.

How do I turn the slope into an angle or a percent grade?

The angle is arctan(m), measured from the horizontal. A slope of 0.75 is 36.87°. The percent grade is the slope times 100, so 0.75 is a 75% grade. A 45° line has slope 1 and a grade of 100%, not 45%.

How do I get the equation of the line?

Find m, then b = y₁ − m × x₁, and write y = mx + b. For (3, 2) and (7, 5), m = 0.75 and b = 2 − 0.75 × 3 = −0.25, so y = 0.75x − 0.25. The tool gives this for any two points except a vertical line.

How do I know if two lines are parallel or perpendicular?

Parallel lines have the same slope. Perpendicular lines have slopes that multiply to −1, so the perpendicular slope is −1/m. The tool shows it. A horizontal line is perpendicular to a vertical one.

Are my numbers uploaded or saved?

No. The maths runs in your browser. What you type is not put in the address bar, not stored and not counted. We only count the kind of line: sloped, horizontal or vertical.

More from FLXCode

Share Slope Calculator