Connect via MCP →

Enter Calculation

Formula

Formula: 3D Distance Between Two Points Calculator

Advertisement

Results

Distance (d)
10.246951
Euclidean distance (same unit as coordinates)
Step Value
X2 - X1 10
Y2 - Y1 2
Z2 - Z1 -1
(X2-X1)² + (Y2-Y1)² + (Z2-Z1)² 105
d = √sum 10.246951

What This Calculator Does

The 3D Distance Between Two Points Calculator finds the straight-line (Euclidean) distance between any two points in three-dimensional Cartesian space. Enter the X, Y, and Z coordinates of each point and the tool returns the distance, shown to six decimal places, along with the intermediate steps. The values are dimensionless coordinates, so the resulting distance carries whatever unit you assume for the inputs (meters, feet, pixels, etc.).

How To Use It

Type the coordinates of the first point into the X1, Y1, Z1 fields and the second point into the X2, Y2, Z2 fields. All six values may be positive, negative, integers, or decimals. Press calculate and read the distance from the highlighted result box. The order of the two points does not matter because each difference is squared.

The Formula Explained

The 3D distance formula extends the Pythagorean theorem to three axes:

$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}$$

You take the difference along each axis, square each difference (which removes the sign), add the three squares together, and take the square root of that sum. The distance is always zero or positive, and it equals zero only when the two points coincide. To compute a 2D distance instead, set both Z values equal (for example, both 0).

Two points in a 3D coordinate system connected by a straight diagonal line representing distance
The distance d is the straight line between two points in 3D X-Y-Z space.

Worked Example

For points (7, 4, 3) and (17, 6, 2): the differences are 10, 2, and -1. Their squares are 100, 4, and 1, summing to 105. The distance is \(\sqrt{105} = 10.246951\). A second example, (5, 6, 2) and (-7, 11, -13), gives differences -12, 5, -15, squares 144, 25, 225, sum 394, so \(d = \sqrt{394} = 19.849433\).

Right-angled box showing the legs delta x, delta y, delta z and the diagonal as the 3D distance
The distance forms the space diagonal of a box with edges \(\Delta x\), \(\Delta y\) and \(\Delta z\).

Definitions & Glossary

The terms below describe the concepts and variables used when computing the straight-line distance between two points in three-dimensional space.

  • Euclidean distance — The straight-line (shortest) distance between two points, measured "as the crow flies" through space rather than along axes or a curved path. In 3D it is given by \(d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}\).
  • Cartesian coordinates — A system that locates a point using signed distances from three mutually perpendicular axes (X, Y, Z) that meet at the origin \((0,0,0)\). A point is written as an ordered triple \((x, y, z)\).
  • \(x_1, y_1, z_1\) — The X, Y, and Z coordinates of the first point, \(P_1 = (x_1, y_1, z_1)\).
  • \(x_2, y_2, z_2\) — The X, Y, and Z coordinates of the second point, \(P_2 = (x_2, y_2, z_2)\).
  • Delta (\(\Delta x, \Delta y, \Delta z\)) — The change, or difference, in each coordinate between the two points: \(\Delta x = x_2 - x_1\), \(\Delta y = y_2 - y_1\), and \(\Delta z = z_2 - z_1\). Because each delta is squared, the order of subtraction (and therefore the sign) does not affect the final distance.
  • Space diagonal — The longest straight line through a rectangular box (cuboid), running between opposite corners. If a box has edge lengths \(\Delta x\), \(\Delta y\), and \(\Delta z\), its space diagonal equals the 3D distance \(\sqrt{\Delta x^2 + \Delta y^2 + \Delta z^2}\) — exactly the value this calculator returns.
  • Relationship to the Pythagorean theorem — The 3D distance formula is the Pythagorean theorem applied twice. First, the diagonal across the X-Y base plane is \(\sqrt{\Delta x^2 + \Delta y^2}\). Treating that diagonal and the vertical offset \(\Delta z\) as the two legs of a second right triangle gives \(d = \sqrt{\left(\sqrt{\Delta x^2 + \Delta y^2}\right)^2 + \Delta z^2} = \sqrt{\Delta x^2 + \Delta y^2 + \Delta z^2}\). The 3D distance is also the magnitude of the vector \(\langle \Delta x, \Delta y, \Delta z \rangle\).

Distance Across Different Point Pairs

The table below works several representative point pairs through the formula \(d = \sqrt{\Delta x^2 + \Delta y^2 + \Delta z^2}\). Each row lists the per-axis differences, the sum of their squares, and the resulting distance. Note that coincident points yield a distance of zero, and that negative coordinates still produce a positive distance because each delta is squared.

Scenario \(P_1\) \(P_2\) \(\Delta x\) \(\Delta y\) \(\Delta z\) Sum of squares Distance \(d\)
Axis-aligned (X only) (0, 0, 0) (5, 0, 0) 5 0 0 25 5
Axis-aligned (Z only) (2, 3, 1) (2, 3, 9) 0 0 8 64 8
Unit cube diagonal (0, 0, 0) (1, 1, 1) 1 1 1 3 \(\sqrt{3} \approx 1.732\)
Clean Pythagorean triple (0, 0, 0) (1, 2, 2) 1 2 2 9 3
General diagonal (1, 2, 3) (4, 6, 15) 3 4 12 169 13
With negatives (-2, -3, -1) (1, 1, -1) 3 4 0 25 5
Coincident points (7, -4, 2) (7, -4, 2) 0 0 0 0 0

For the "general diagonal" row, the full substitution is \(d = \sqrt{(4-1)^2 + (6-2)^2 + (15-3)^2} = \sqrt{9 + 16 + 144} = \sqrt{169} = 13\).

FAQ

Does the order of the points change the result? No. Because each coordinate difference is squared, swapping the two points produces the same distance.

What unit is the answer in? The result is in the same unit you used for the coordinates; the calculator performs no unit conversion.

Can I use negative coordinates? Yes. Negative integers and decimals are fully supported for all six values.

Last updated: