Distance Calculator

Distance and midpoint between two points, in 2D or 3D — with the formula shown step by step.

Point A

Point B

How to use the distance calculator

  1. Pick 2D or 3D. The toggle shows or hides the z coordinates.
  2. Enter both points. Decimals and negatives are fine.
  3. Press Calculate. You get the distance, the midpoint, the per-axis deltas, and the formula with your values plugged in.
  4. Check the work. The substituted formula is exactly what a teacher expects to see on paper.

Frequently asked questions

What is the distance formula?

d = √((x2−x1)² + (y2−y1)²). It is the Pythagorean theorem applied to the horizontal and vertical gaps between the points.

How do you find distance in 3D?

Add the z term: d = √((x2−x1)² + (y2−y1)² + (z2−z1)²) — Pythagoras applied twice.

What is the midpoint formula?

Average the coordinates: M = ((x1+x2)/2, (y1+y2)/2), and add (z1+z2)/2 for 3D. The midpoint sits exactly halfway between the points.

Can distance be negative?

No. A square root is never negative, and squaring the deltas erases their signs — distance is always zero or positive.

What units does the answer use?

Whatever units your coordinates use — meters in, meters out; pixels in, pixels out. The formula itself is unit-agnostic.

More from the codex