CalcKit CalcKit
My Calculators
Sign in Sign up

Distance between 2 points (3D)

Distance between 2 points (3D)
First point
Second point
Result

This calculator finds the distance between two points in 3D space, (X1, Y1, Z1) and (X2, Y2, Z2): the length of the straight line between them, also called the Euclidean distance.

The distance formula

d = √((X2 - X1)² + (Y2 - Y1)² + (Z2 - Z1)²)

It is the Pythagorean theorem used twice. The differences along the three axes are the edges of a box, and the distance is the box's space diagonal, from one corner to the opposite corner. Since the differences are squared, the order of the points doesn't matter.

The calculator also works backwards. Given one point, the distance, and two coordinates of the other point, it finds the third. Two values fit, one on each side; the calculator gives the one where the first point's coordinate is the smaller (X1 below X2, and so on).

Example

The distance from (1, 2, 3) to (3, 5, 9):

  1. The differences:

    3 - 1 = 2, 5 - 2 = 3 and 9 - 3 = 6

  2. The distance:

    d = √(2² + 3² + 6²) = √49 = 7

Frequently asked questions

How do you find the midpoint between two points in 3D?

Average each coordinate: ((X1 + X2) / 2, (Y1 + Y2) / 2, (Z1 + Z2) / 2). For the points above, it is (2, 3.5, 6).

What about points in a plane?

Leave out the Z difference: d = √((X2 - X1)² + (Y2 - Y1)²). The 2D Distance Calculator does it.