Maths / Graphs

Slope Calculator (from Two Points)

Find the slope of the line through two points as a decimal and an exact fraction, with the equation y = mx + b, both intercepts, the angle to the x-axis, the percentage grade, the distance between the points, and a plot.

Slope Calculator (from Two Points): Slope is rise over run, m = (y₂ − y₁) ÷ (x₂ − x₁); through (1, 2) and (4, 8), m = 6 ÷ 3 = 2. The intercept b = y₁ − m·x₁ gives the equation y = 2x + 0. The angle with the x-axis is arctan(m), 63.43°, and the grade is m × 100%. A vertical line, where x₂ = x₁, has no defined slope and is written x = constant. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
Slope calculatorLocal processing

Runs entirely in your browser

Slope m2Δy ÷ Δx = 6 ÷ 3
Equationy = 2x + 0
y-intercept0x-intercept 0
Angle with the x-axis63.4349°grade 200%
Distance between the points6.708204
(1, 2)(4, 8)

Slope is rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). The line then passes through both points as y = mx + b, with b = y₁ − m·x₁. A positive slope rises to the right, zero is horizontal, and a vertical line has no defined slope. As a percentage grade, used for roads and ramps, it is m × 100.

Worked example

Through (2, 3) and (5, −3): m = (−3 − 3) ÷ (5 − 2) = −2, b = 3 − (−2 × 2) = 7, so y = −2x + 7, crossing the x-axis at 3.5.

To plot the line or several functions, use the graphing calculator.

Slope and real data

A slope through just two points can mislead when the data are noisy; fitting a line through all the points by least squares gives a better estimate.

The linear regression calculator does that, and the midpoint calculator finds the point halfway between two.

How to use it

  1. Enter the coordinates of the two points.
  2. Read the slope, the equation, and the intercepts.
  3. Check the angle, grade, and distance, and the plot.

Privacy & limitations

Everything is calculated in your browser.

Related tools

Frequently asked questions

What does a negative slope mean?

The line falls from left to right: through (2, 3) and (5, −3) the slope is −2, so y drops 2 for every 1 step in x.

How do I find a perpendicular line?

Its slope is the negative reciprocal, −1 ÷ m: perpendicular to a slope of 2 is −½.

What is the difference between slope and grade?

Grade is the slope as a percentage, used for roads and ramps: a slope of 0.08 is an 8% grade, rising 8 m over 100 m.

Free tool · runs in your browser · no account required