Skip to content

Slope Calculator

Enter the coordinates of two points. The calculator returns the slope as a number, a percentage and an angle, plus the distance between the points and the line equation.

Result

Slope (m)
2
Equation of the line
y = 2x + 0
Percent grade
200%
Angle of inclination
63.4349°
Distance between the points
6.708204
Midpoint
(2.5, 5)
Rise and run
6 over 3
y-intercept
0
x-intercept
0

Formula

  • m = (y₂ − y₁) ÷ (x₂ − x₁)
  • Percent grade = m × 100
  • Angle = arctan(m)
  • Distance = √((x₂ − x₁)² + (y₂ − y₁)²)
  • Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
  • y = mx + b, where b = y₁ − m × x₁

How the Slope Calculator works

Slope measures steepness as rise over run: the change in y for each unit of change in x. A positive slope climbs from left to right, a negative slope falls, a zero slope is flat and a vertical line has no defined slope.

The same number can be written as a percent grade, used for roads and ramps, or as an angle. A slope of 1 is a 100 percent grade and a 45 degree angle.

Worked example

Between (1, 2) and (4, 8): m = (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2. The line is y = 2x + 0, the distance is √(3² + 6²) = 6.7082 and the midpoint is (2.5, 5).

Frequently asked questions

How do I convert slope to a percentage?

Multiply by 100. A rise of 1 foot over a run of 12 feet is a slope of 0.0833, or an 8.33 percent grade, the maximum for an ADA wheelchair ramp.

What is the slope of a horizontal and a vertical line?

A horizontal line has a slope of 0. A vertical line has an undefined slope, because the run is zero.

Related calculators

All math and statistics calculators · All calculators

Related unit converters

Calculations run in your browser and nothing you enter is sent to a server. Results are provided for general information. Check critical figures independently before relying on them.

☕ Like this tool?

Buy me a coffee to support development

☕ Support UnitGenie

If this tool has been helpful, consider buying me a coffee to support development and keep it free for everyone!