Skip to content
CornerTools

Slope Calculator

Slope, distance, midpoint and the line's equation from two points, a point and a slope, or an equation, with a graph and the working.

Find from
run 6rise 3(−2, 1)(4, 4)(−4, 0)(0, 2)
Slope

m = 1/2

m = 0.5

Line
y = x/2 + 2
Point-slope form
y − 1 = (1/2)(x + 2)
Standard form
x − 2y = −4
x-intercept
(−4, 0)
y-intercept
(0, 2)
Distance
3√5 ≈ 6.71
Midpoint
(1, 2.5)
Angle of inclination
≈ 26.57°
Grade
50%
Roof pitch
6:12

Enter two points and the calculator gives the slope as a fraction and a decimal, the line through them in slope-intercept, point-slope and standard form, both intercepts, the distance and midpoint, and the angle of inclination, percent grade and roof pitch. The points, the line and its rise and run are drawn on axes to scale, and every figure is worked in your numbers.

The line can also come from a point and a slope (or an angle), or from its equation typed in any form, and the parallel and perpendicular lines through a point can be found from any line.

How to use it

Two points takes x₁, y₁, x₂ and y₂ as whole numbers, decimals or fractions, worked exactly. Point and slope takes a point and a slope as a fraction or decimal (3/4, 0.75), or as an angle with a degree sign (30°). Equation reads a line in any form, such as 2x + 3y = 6 or y = −x/2 + 4, and is where a line's link in the Graphing Calculator opens. Parallel and perpendicular takes a line in the same way and a point, and also gives the shortest distance from the point to the line and where the perpendicular meets it.

Slopes and the numbers in each equation are fractions; coordinates are decimals where they end and fractions where they do not. Decimal places rounds the decimals: the slope's decimal, the distance, the angle and the grade.

How it works

Slope is rise over run: the change in y divided by the change in x between the points. A vertical line has no run, so its slope is undefined and its equation is x = a number; a level line has no rise and slope 0. The distance between the points is the hypotenuse of the right triangle the rise and run make, so it comes from Pythagoras, and stays exact as a surd: √45 = 3√5.

Standard form Ax + By = C is given in whole numbers with no common factor and A positive (B when there is no x term), so one line always has one standard form. A slope given as an angle is its tangent: exact at 0°, 45°, 90° and 135°, where the tangent is rational or the line vertical, and in decimals at any other angle, where the line has no standard form in whole numbers.

Slope: m = (y₂ − y₁) ÷ (x₂ − x₁)
Distance: d = √((x₂ − x₁)² + (y₂ − y₁)²)
Midpoint: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
Slope-intercept y = mx + b, point-slope y − y₁ = m(x − x₁), standard Ax + By = C
Angle of inclination θ = tan⁻¹ m; grade = m × 100%; pitch = 12m : 12
Perpendicular slope −1 ÷ m; distance from (x₁, y₁) to Ax + By = C: |Ax₁ + By₁ − C| ÷ √(A² + B²)

Examples

Two points

For the points (−2, 1) and (4, 4), the slope is m = 1/2, the line is y = x/2 + 2, and the distance between the points is 3√5 ≈ 6.71:

  1. The rise, the change in y y₂ − y₁ = 4 − 1 = 3
  2. The run, the change in x x₂ − x₁ = 4 − (−2) = 6
  3. The slope is rise ÷ run m = 3 ÷ 6 = 1/2
  4. The distance, by Pythagoras d = √(6² + 3²) = √45 = 3√5 ≈ 6.71
  5. The midpoint, the average of each coordinate ((−2 + 4) ÷ 2, (1 + 4) ÷ 2) = (1, 2.5)
  6. The y-intercept: b = y₁ − m × x₁ b = 1 − 1/2 × (−2) = 2
  7. So the line, in slope-intercept form, is y = x/2 + 2
  8. In standard form, with whole numbers and no common factor x − 2y = −4

A point and a slope

Through (1, 2) with slope 3/4, the line is y = 3x/4 + 5/4, or 3x − 4y = −5 in standard form, and it crosses the x-axis at (−5/3, 0).

A line typed as an equation

Equation
2x + 3y = 6

Solving for y gives y = −2x/3 + 2, so the slope is m = −2/3, with intercepts (3, 0) and (0, 2).

Parallel and perpendicular lines

Line
y = 2x + 1

Through (3, −1), the parallel line is y = 2x − 7 and the perpendicular is y = −x/2 + 1/2, whose slope times 2 is −1. The point is 8√5/5 ≈ 3.58 from the line, which the perpendicular meets at (−0.2, 0.6).

A vertical line

The points (3, 1) and (3, 5) share their x, so the run is 0: the slope is undefined, the line is x = 3, and its angle of inclination is 90°.

Frequently asked questions

All three measure steepness. Slope is rise over run, so a slope of 1/2 climbs 1 for every 2 across. The angle of inclination is the angle that climb makes with the level, tan⁻¹(1/2), about 26.57°. Grade is the slope as a percentage, 50%, which is how roads and ramps are signed; roofs give the same slope as a pitch, the rise in 12 of run, 6:12. A 100% grade is a 45° angle, not a vertical wall.
Its run is 0, and rise ÷ 0 has no value. Lines approach vertical as their slopes grow without bound, from either side, positive and negative, so no single number, not even infinity, fits both. The line is written x = a number instead.

See also