Distance between two points (2D or 3D)

Enter the coordinates of the two points: the page gives the length of the segment joining them.

Distance between two points (2D or 3D)

Dimension

Result

5Distance AB

d = √(3² + 4²) = √25 = 5
Change in x (x₂ − x₁)
3
Change in y (y₂ − y₁)
4
Midpoint
(2.5, 4)

Distance between two points (2D or 3D)

Inputs

Dimension
Plane (2D)
x of point A
1
y of point A
2
x of point B
4
y of point B
6

How it is calculated

Compute the changes Δx = x₂ − x₁, Δy = y₂ − y₁ (and Δz in 3D).

Result

Distance AB

5
Change in x (x₂ − x₁)
3
Change in y (y₂ − y₁)
4
Midpoint
(2.5, 4)

How it is calculated

  1. Compute the changes Δx = x₂ − x₁, Δy = y₂ − y₁ (and Δz in 3D).
  2. Distance = √(Δx² + Δy² + Δz²): this is Pythagoras’ theorem.
  3. Midpoint = average of the two points’ coordinates.

Example

A(1, 2) and B(4, 6): Δx = 3, Δy = 4, d = √(9 + 16) = √25 = 5. Midpoint (2.5, 4).

Good to know

  • This is the straight-line distance in an orthonormal grid, not a road trip.
  • For two cities on Earth you need a distance on the sphere (latitude, longitude), not this formula.
  • Both points must use the same unit.

Frequently asked questions

What is this tool used for?

Enter the coordinates of the two points: the page gives the length of the segment joining them.

How is the result calculated?

Compute the changes Δx = x₂ − x₁, Δy = y₂ − y₁ (and Δz in 3D).

What should I check before using the result?

This is the straight-line distance in an orthonormal grid, not a road trip.

Updated October 10, 2026

Indicative result. For an important decision, check with a professional.