Slope Calculator (Two Points)

Calculate the slope (gradient), distance, angle and line equation between two points, in slope-intercept and point-slope form.

Result

Fill in the fields above, then press Calculate.

A slope calculator finds the slope, y-intercept and equation of a line from two points or a point and slope. In UK and Australian maths, slope is called the gradient, so a gradient calculator finds the same number.

Slope formula

The slope m of the line through the points (x₁, y₁) and (x₂, y₂) is the rise divided by the run:

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

For (3, 4) and (9, 12): m = (12 − 4) ÷ (9 − 3) = 8 ÷ 6 = 4/3 ≈ 1.3333.

If x₁ = x₂ the line is vertical: the run is zero, so the slope is undefined and the equation is x = a constant.

Worked examples

Worked examples
PointsSlopeSlope-intercept formPoint-slope form
(3, 4) and (9, 12)m = 4/3 ≈ 1.3333y = 4/3xy − 4 = 4/3(x − 3)
(−2, 5) and (4, −7)m = −2y = −2x + 1y − 5 = −2(x + 2)
(2, 1) and (2, 5)undefined (vertical line)x = 2—

For (3, 4) and (9, 12) the distance between the points is 10 and the line makes an angle of 53.13° with the x-axis.

Point-slope form vs slope-intercept form

Point-slope form, y − y₁ = m(x − x₁), is the quickest way to write a line when you know one point on it and the slope. Slope-intercept form, y = mx + b, shows the slope and the y-intercept directly, which makes the line easy to graph.

Choose an input mode: two points, point and slope, or slope and intercept. Enter the known values. The calculator will determine the line equation, slope, distance between points, and other properties.

Examples

Two points

Points (1,2) and (3,8): m = (8-2)/(3-1) = 6/2 = 3, equation: y = 3x - 1

Point-slope

Point (2,5), slope 3: y - 5 = 3(x-2), so y = 3x - 1

Slope-intercept

Slope 2, intercept 3: y = 2x + 3

Frequently Asked Questions

What does slope represent?
Slope measures the steepness and direction of a line. It represents the rate of change: how much y changes for each unit change in x.
Is slope the same as gradient?
Yes. Gradient is the UK and Australian name for slope: both are the rise divided by the run, m = (y₂ − y₁) ÷ (x₂ − x₁).
What is a perpendicular slope?
The perpendicular slope is the negative reciprocal of the original slope: m_perp = -1/m. Perpendicular lines intersect at 90 degrees.
What if the slope is undefined?
A vertical line has undefined slope because the denominator (x₂ - x₁) is zero. Vertical lines are written as x = constant.

Quick Tips

  • •Double-check your inputs — small errors lead to incorrect results.
  • •Use decimal form for fractions when entering values.
  • •Remember that vertical lines have undefined slope and cannot be expressed in y = mx + b form.