CZ
CalcyZone
Mathematics CalcyZone Calculator

Slope Calculator (Two Points)

Find the slope, line equation, distance and angle between two points.

Slope m
2
Line equation
y = 2x + 0
Distance
6.7082
Angle
63.43°

Step-by-step working

  1. m = (y₂ − y₁) / (x₂ − x₁) = (8 − 2) / (4 − 1)
  2. b = y₁ − m·x₁
  3. d = √((Δx)² + (Δy)²)

Mathematical Formula

m = (y₂ − y₁) / (x₂ − x₁); b = y₁ − m·x₁; d = √((x₂ − x₁)² + (y₂ − y₁)²); θ = atan2(Δy, Δx).

Overview & Explanation

Slope is rise over run. Two points fully determine a line, its length and angle.

How It Works

  • Subtract coordinates.
  • Divide rise by run (vertical lines have undefined slope).
  • Solve for the intercept.

Practical Applications

  • Graphing linear equations.
  • Gradient of a road or roof.

Slope from two points

Slope m = (y2 - y1) / (x2 - x1), the rise divided by the run. For the points (2, 3) and (6, 11), the rise is 11 - 3 = 8 and the run is 6 - 2 = 4, so m = 2. The line climbs 2 units for every 1 unit to the right.

The y-intercept is b = y1 - m x x1 = 3 - 2 x 2 = -1, giving the line y = 2x - 1. The angle with the x-axis is arctan(2), about 63.43 degrees.

Special cases and grades

A horizontal line has slope 0. A vertical line has a run of 0, so its slope is undefined. Perpendicular lines have slopes that multiply to -1, so a line perpendicular to slope 2 has slope -1/2. On roads and ramps slope is often written as a percentage grade: a rise of 5 m over 100 m of horizontal distance is a 5% grade.

Example 1: (1, 2) to (4, 8)

Slope 2.

1

Inputs

x₁: 1 · y₁: 2 · x₂: 4 · y₂: 8

= entered
2

Step 1

m = (y₂ − y₁) / (x₂ − x₁) = (8 − 2) / (4 − 1)

3

Step 2

b = y₁ − m·x₁

4

Step 3

d = √((Δx)² + (Δy)²)

5

Slope m

Result

= 2

Example 2: (−2, 3) to (6, −1)

Negative slope.

1

Inputs

x₁: -2 · y₁: 3 · x₂: 6 · y₂: -1

= entered
2

Step 1

m = (y₂ − y₁) / (x₂ − x₁) = (-1 − 3) / (6 − -2)

3

Step 2

b = y₁ − m·x₁

4

Step 3

d = √((Δx)² + (Δy)²)

5

Slope m

Result

= -0.5

How it's calculated & sources

m = (y₂ − y₁) / (x₂ − x₁); b = y₁ − m·x₁; d = √((x₂ − x₁)² + (y₂ − y₁)²); θ = atan2(Δy, Δx).

Frequently Asked Questions

What is an undefined slope?
A vertical line (x₁ = x₂) has zero run, so the slope is undefined.
Slope as a percentage?
Multiply m by 100 (grade %).
Parallel and perpendicular lines?
Parallel lines share m; perpendicular slopes multiply to −1.
Does the order of the points matter?
No. Swapping the points flips the sign of both rise and run, so the ratio stays the same.
What does a negative slope mean?
The line falls as x increases. A slope of -3 drops 3 units for every unit to the right.