3D Distance Calculator
Find the straight-line Euclidean distance between two points in three-dimensional Cartesian space, with a transparent axis-by-axis breakdown.
Coordinates
The first point
Required decimal coordinate; use the same unit as the other axes.
Required decimal coordinate; negative values are valid.
Required decimal coordinate on the third axis.
The second point
Required decimal coordinate; sample value creates Δx = 3.
Required decimal coordinate; sample value creates Δy = 4.
Required decimal coordinate; sample value creates Δz = 12.
Live result
Distance (d)
13
The straight-line distance from (1, 1, 1) to (4, 5, 13) is 13 units.
d = √(3² + 4² + 12²) = √169 = 13
Enter all six coordinates to calculate the 3D distance.
Coordinate breakdown
Each row shows the coordinate difference used by the Euclidean distance formula.
| Axis | First coordinate | Second coordinate | Difference | Squared difference |
|---|---|---|---|---|
| x | 1 | 4 | 3 | 9 |
| y | 1 | 5 | 4 | 16 |
| z | 1 | 13 | 12 | 144 |
The squared differences sum to the squared distance. Their units are the square of whatever consistent coordinate unit you use.
How to use this 3D distance calculator
What this calculator does
This calculator finds the straight-line Euclidean distance between two points described by Cartesian coordinates in three-dimensional space. It treats the coordinate axes as mutually perpendicular and applies the three-dimensional extension of the Pythagorean theorem. The result is an exact mathematical identity for the coordinates you provide; it is not a route length, travel distance over terrain, geodesic distance on Earth, or a measurement-error model. If your coordinates represent physical measurements, the numerical result inherits the same physical unit and the same measurement limitations as those inputs.
When to use it
Use it when you need the direct separation between two locations in a 3D model, compare two points in engineering or CAD-style coordinates, check the magnitude of a displacement vector, or verify a coordinate-geometry exercise. OpenStax presents the same distance-in-space relationship in its vectors in three dimensions treatment.
How to calculate
- The calculator opens with a complete demonstration: first point (1, 1, 1) and second point (4, 5, 13). Its valid XLSX export is available immediately.
- Replace X1, Y1, and Z1 with the coordinates of the first point. Then replace X2, Y2, and Z2 with the second point. Use one consistent unit system across all six coordinates.
- Read Distance (d) for the straight-line result. The Δx, Δy, and Δz cards show signed coordinate changes, while Squared distance is the sum of their squares before the square root is taken.
- Use the Coordinate breakdown table to audit each subtraction and squared contribution. Select Download Excel to export the current validated inputs and results as a binary Office Open XML workbook.
- Reset clears all six demonstration inputs, results, table rows, validation residue, and export state. Download Excel is then disabled until you enter a complete valid set of coordinates again.
Input guide
X1, Y1, and Z1 are the required coordinates of the first point. Each accepts a standard decimal number such as 1, -2.5, or 0.125 using a period as the decimal separator. Commas, scientific notation, unit suffixes, and nonnumeric text are rejected rather than silently reinterpreted. Negative and zero coordinates are valid. X1 moves the first point along the x-axis, Y1 along the y-axis, and Z1 along the z-axis; changing any one of them changes the corresponding axis difference. A common mistake is mixing units, such as metres on one axis and centimetres on another.
X2, Y2, and Z2 are the required coordinates of the second point and follow the same accepted format. Example values 4, 5, and 13 pair with the startup first point to produce axis differences 3, 4, and 12. The coordinate values themselves may be positive, zero, or negative; the final distance cannot be negative because differences are squared before they are summed. For numerical safety, this implementation accepts finite decimal coordinates with absolute value up to 1e150 and rejects values that would make the derived squared terms nonfinite.
Output guide
Distance (d) is the Euclidean straight-line separation in the same unit as your coordinates. A zero result means the two points coincide. Larger values mean greater separation, without implying anything about direction. Δx, Δy, and Δz are signed coordinate differences computed as second point minus first point; their sign indicates direction along each axis, while the header pills |Δx|, |Δy|, and |Δz| show magnitudes only. Squared distance is Δx² + Δy² + Δz² and therefore has squared units. The displayed formula substitutes the current differences directly so you can audit the calculation.
The Coordinate breakdown table has five columns: Axis identifies x, y, or z; First coordinate and Second coordinate repeat the corresponding inputs; Difference is second minus first; and Squared difference is the nonnegative contribution to the squared distance. These rows are exact transformations of the current inputs, not forecasts or recommendations. The NIST description of Euclidean distance likewise defines it as straight-line distance based on squared coordinate differences.
Worked example
With the startup points P1 = (1, 1, 1) and P2 = (4, 5, 13), the coordinate differences are Δx = 4 - 1 = 3, Δy = 5 - 1 = 4, and Δz = 13 - 1 = 12. Squaring them gives 9, 16, and 144. Their sum is 169, so d = √169 = 13. That is why the first-open Distance (d) value is exactly 13 and the Squared distance card is 169. The same model values are used for the live page, audit table, and startup workbook checkpoints.
Learn more
For a focused mathematical treatment of straight-line separation in three-space, see Wolfram MathWorld's point-to-point distance in three dimensions. The formula works because the displacement between the points has perpendicular x, y, and z components whose squared lengths add.
Formula and interpretation
The model computes d = √((x2 - x1)² + (y2 - y1)² + (z2 - z1)²). Swapping the two points reverses all three signed deltas but leaves every squared difference and the final distance unchanged. Translating both points by the same offset also leaves the distance unchanged, because only coordinate differences matter.
Common mistakes
- Do not add signed deltas directly. Their squares must be added before the square root is taken.
- Do not mix coordinate units unless you first convert them to one consistent unit.
- Do not confuse Euclidean distance with path length, surface distance on a sphere, or distance constrained by obstacles.
- A negative coordinate is valid; a negative distance is not. The distance formula always returns a nonnegative scalar.