Skip to content
CalcPilot
Salary calculator: gross to net pay for Canada, the US, the UK, France and Germany
Math

Slope Calculator

Find the slope, distance, and midpoint between two points.

Slope = (y2 − y1) ÷ (x2 − x1)
Slope

2

Distance8.9443
Midpoint(3, 6)

About this calculator

What Is Slope?

Slope, also called gradient, is a number that describes how steep a line is and which way it leans. It is written m and defined as "rise over run": the change in vertical position divided by the change in horizontal position between two points. Roads, roofs, ramps and graphs all use slope. This slope calculator finds it from two points, or from one point and a known slope, and also gives the angle of incline and the distance between the points.

The Slope Formula

m = (y₂ − y₁) ÷ (x₂ − x₁) = Δy ÷ Δx. For the points (1, 2) and (5, 10), the slope is (10 − 2) ÷ (5 − 1) = 2. The angle of incline θ follows from m = tan(θ), so θ = arctan(m) — here about 63.4°. The straight-line distance between the two points comes from the Pythagorean theorem, d = √(Δx² + Δy²), because Δx and Δy form the legs of a right triangle.

Worked Example

For the points (1, 2) and (5, 10): the slope is 2 — for every 1 unit right, the line rises 2 units. The distance between the points is 8.94 units, and the midpoint is (3, 6).

What the Sign and Size Tell You

  • m > 0: the line rises from left to right.
  • m < 0: the line falls from left to right.
  • m = 0: the line is horizontal.
  • Vertical line: the slope is undefined, because Δx is 0 and division by zero has no value.

The larger the absolute value of m, the steeper the line.

The Equation of the Line

Once you know the slope and a point, you can write the line: y − y₁ = m(x − x₁) (point-slope form), or y = mx + b where b is the y-intercept, the height at which the line crosses the vertical axis. Parallel lines have equal slopes, and perpendicular lines have slopes that are negative reciprocals (m and −1/m).

Slope in the Real World

Civil engineers describe road grades as a percentage — a 6% grade rises 6 m for every 100 m of horizontal distance. Accessibility ramps in many places must not exceed a slope of about 1 : 12 (roughly 8.3%). To work with the right triangle behind a slope, try the Triangle Calculator or the Pythagorean Theorem Calculator.

Worked example

Between (1, 2) and (5, 10), the slope is 2 (a rise of 8 over a run of 4) — the line climbs 2 units for every 1 unit it moves right.

Frequently asked questions

What does a negative slope mean?

The line falls as it moves right — for every unit increase in x, y decreases. A positive slope rises left to right; a slope of 0 is a flat horizontal line.

Why is the slope "undefined" for a vertical line?

Slope is rise over run, and a vertical line has zero run (both points share the same x-coordinate) — dividing by zero is undefined, so vertical lines are simply described as having no slope rather than a slope of infinity.

What's the midpoint used for?

It's the point exactly halfway between the two coordinates — useful for finding the center of a line segment, such as the midpoint of a diameter when working with circles.

More Math calculators

Advertise on CalcPilot