Slope, Distance and Midpoint Calculator

From two points, find the slope, the distance between them, the midpoint and the equation of the line, with the working.

Runs in your browserNo sign-upWorks offline

The tool is loading…

What the Slope, Distance and Midpoint Calculator does

The Slope, Distance and Midpoint Calculator takes two points on a graph, (x₁, y₁) and (x₂, y₂), and works out everything about the line between them: the slope, as a decimal and a simplified fraction, the angle it makes with the x axis, the distance between the points, the midpoint, the equation of the line in the form y = mx + c, and the slope of a line at right angles to it. These are the core skills of coordinate geometry in school maths.

How to use it

  1. Enter the coordinates of the first point.
  2. Enter the coordinates of the second point.
  3. Read the slope, then the equation, distance and midpoint below it.

Example

For the points (1, 2) and (4, 6), the rise is 4 and the run is 3, so the slope is 4/3 ≈ 1.3333. The line is y = 1.3333x + 0.6667, it makes an angle of about 53.13° with the x axis, the distance between the points is √(3² + 4²) = 5 and the midpoint is (2.5, 4).

The formulas

Slope m = (y₂ − y₁) ÷ (x₂ − x₁): the rise divided by the run. A positive slope climbs from left to right, a negative one falls, zero is flat, and a vertical line has no defined slope because the run is zero.

The distance is √((x₂ − x₁)² + (y₂ − y₁)²), which is Pythagoras applied to the rise and run. The midpoint averages the coordinates: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). A perpendicular line has the slope −1 ÷ m.

Questions people ask

Is anything I enter sent anywhere?

No. The calculator works entirely in your browser, so your numbers stay on your device.

Why is the distance shown with a square root?

When the points have whole-number coordinates, the exact distance is often a surd such as 2√5. The calculator shows the exact form and the decimal.

What does a slope of 0 or an undefined slope mean?

A slope of 0 is a flat, horizontal line, such as y = 4. An undefined slope is a vertical line, such as x = 2, where the run is zero and you cannot divide by it.

How do I find the equation from the slope?

Use y = mx + c: put in the slope m and one point’s x and y, then solve for c. The calculator does this for you and shows the line in that form.

Related tools