Distance Calculator

Distance between two points, midpoint and slope — in 2D or 3D, with unit conversion.

100% FreeNo sign-upPrivate — runs in your browser
3D mode
Add a z-coordinate for each point.

This is the straight-line (Euclidean) distance between two points — not a road distance. Results update live.

—

Distance between the points

Midpoint
—
Slope (2D)
—
In metres
—
In kilometres
—
In miles
—
In feet
—
Enter both points to see the step-by-step working.
Copied to clipboard

How to use this tool

1
Enter the first point

Type the x and y coordinates of the first point.

2
Enter the second point

Type the x and y coordinates of the second point.

3
Choose the unit

Pick the unit your coordinates are in — the distance is also shown converted to metres, kilometres, miles and feet.

4
Use 3D mode if needed

Switch on 3D mode if your points also have a z-coordinate.

Formula & worked example

2D: d = √((x₂ − x₁)² + (y₂ − y₁)²). 3D: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). Slope (2D) = (y₂ − y₁) ÷ (x₂ − x₁).

Points (0, 0) and (3, 4) are 5 units apart: d = √(3² + 4²) = √25 = 5. Their midpoint is (1.5, 2) and the slope of the line joining them is 4 ÷ 3 ≈ 1.3333.

Limitations — read this before you rely on it

This is a flat, straight-line (Euclidean) distance on a coordinate grid. It does not account for roads, terrain, obstacles, or the curvature of the Earth, so it is not suitable for long real-world geographic distances, where a great-circle or route distance is needed. Slope is only defined for 2D points and is undefined for a vertical line (where x₂ = x₁).

Frequently asked questions

Enter the x and y coordinates of both points. The calculator gives the straight-line distance, the midpoint and (in 2D) the slope, with the full working shown.

Use the distance formula: d = √((x₂ − x₁)² + (y₂ − y₁)²). For 3D points, add (z₂ − z₁)² inside the square root. This is the Euclidean distance — the length of the straight line between the points.

Yes. Switch on 3D mode and enter a z-coordinate for each point. The distance then includes the depth difference as well as the horizontal and vertical differences.

The midpoint is the average of each coordinate: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). It is the point exactly halfway between the two points.

No. This gives the straight-line distance, not a road, walking or driving distance. For travel distances, use a maps or route planner.