MATHS & STATISTICS / ALGEBRA

Slope calculator: slope, distance and midpoint

Enter two points to find the slope of the line through them, its equation, the distance between the points, the midpoint and the angle.

Last reviewed:

← All tools

Your numbers

◈ Your values stay in your browser. No account needed.
YOUR RESULT

Enter your numbers to see a result.

WORKED EXAMPLE

Slope calculator: slope, distance and midpoint: a worked example

With point 1: x₁ 1, point 1: y₁ 2, point 2: x₂ 4, point 2: y₂ 11, the slope (m) is 3.

Inputs
Point 1: x₁1
Point 1: y₁2
Point 2: x₂4
Point 2: y₂11
Results
Slope (m)3
Y-intercept-1
Distance between the points9.486832981
Midpoint x2.5
Midpoint y6.5
Angle of inclination71.56505118 °
Equation of the liney = 3x − 1
THE METHOD

How it works

The slope measures how steeply a line rises: the change in y for each unit change in x. A positive slope rises to the right, a negative slope falls, zero is horizontal and a vertical line has no defined slope. The calculator also gives the y-intercept and the line's equation, the straight-line distance between the points, their midpoint and the angle the line makes with the positive x-axis.

FormulaSlope m = (y₂ − y₁) ÷ (x₂ − x₁). Line: y = mx + b with b = y₁ − m·x₁. Distance = √((x₂ − x₁)² + (y₂ − y₁)²).
ASSUMPTIONS

Assumptions and limits

  • Points are on a flat Cartesian plane with the same scale on both axes.
  • The angle of inclination is measured anticlockwise from the positive x-axis and lies between 0° and 180°.
  • The distance is the straight-line (Euclidean) distance.
  • Results are estimates based on the inputs and assumptions on this page, not professional advice.
  • Try this: use “Save scenario A”, change one input and compare the two results side by side.
QUESTIONS

Frequently asked questions

How is the result of the “Slope calculator: slope, distance and midpoint” calculated?

Slope m = (y₂ − y₁) ÷ (x₂ − x₁). Line: y = mx + b with b = y₁ − m·x₁. Distance = √((x₂ − x₁)² + (y₂ − y₁)²). The slope measures how steeply a line rises: the change in y for each unit change in x. A positive slope rises to the right, a negative slope falls, zero is horizontal and a vertical line has no defined slope. The calculator also gives the y-intercept and the line's equation, the straight-line distance between the points, their midpoint and the angle the line makes with the positive x-axis.

What does the worked example show?

With point 1: x₁ 1, point 1: y₁ 2, point 2: x₂ 4, point 2: y₂ 11, the slope (m) is 3. Y-intercept: -1; Distance between the points: 9.486832981; Midpoint x: 2.5; Midpoint y: 6.5; Angle of inclination: 71.56505118 °; Equation of the line: y = 3x − 1.

What assumptions and limits apply?

This is an estimate based on the inputs and assumptions shown on this page, not professional advice. Check anything with financial, health or safety consequences independently.

Is my data private?

Yes. Calculations run in your browser and your numbers are not sent to a server. A share link contains the inputs you choose to share, so check it before sending it to anyone.

How do I calculate slope from two points?

Subtract the y-values and divide by the difference of the x-values in the same order. For (1, 2) and (4, 11): (11 − 2) ÷ (4 − 1) = 3, so y rises 3 for every 1 step in x.

Why is the slope of a vertical line undefined?

Both points share the same x-value, so the run is zero and the slope would require dividing by zero. The line's equation is written x = constant instead.

How is slope related to a percentage gradient?

Multiply the slope by 100. A slope of 0.08 is an 8% gradient: 8 units of rise for 100 units of horizontal distance.

FOR WEBSITE OWNERS

Embed this calculator on your site

Free to use. Paste this where you want the calculator to appear. It resizes itself and links back to Calculator786.