3D Distance Calculator
This 3D Distance Calculator measures how far apart two points in space are, and shows the working line by line. The gap along each axis is found first, each gap is squared, and the square root of their total is the straight-line distance. Squaring removes the signs, so the order of the two points never changes the answer. Following the same pattern every time keeps the three axis gaps separate until the very end.
Enter the coordinates of \(P_{1} = (x_{1}, y_{1}, z_{1})\) and \(P_{2} = (x_{2}, y_{2}, z_{2})\).
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Useful Tips to Remember
The 3D distance formula is the 2D one with a third term for z. Subtract in the same order for all three coordinates, although squaring means the order of the points does not change the answer. A distance is never negative. If two coordinates match, that term is 0, but it still belongs in the formula.
Required knowledge
- How to subtract numbers, including negatives, covered in the Subtraction of Small Numbers Calculator.
- How to simplify a square root, covered in the Simplifying Radicals Calculator.
- The same idea on a flat grid, covered in the Distance Between Two Points Calculator.
Where Is the 3D Distance Formula Used?
The 3D distance formula measures straight-line distances in space, which is needed anywhere objects have three coordinates. Drones, aircraft and satellites use it to work out how far apart they are. Game engines check 3D distances for collisions and for when enemies notice the player. Chemists measure bond lengths between atoms from their coordinates, and in data science the same formula extends to any number of dimensions to compare data points.
- Distances between drones, aircraft and satellites
- Collision and range checks in 3D games
- Bond lengths between atoms in chemistry
- Measuring parts in CAD and 3D printing
- Nearest-neighbour searches in data science
3D Distance Practice Problems
Example 1 finds the distance from \((1, 2, 3)\) to \((4, 6, 3)\), which is a whole number, and Example 2 measures from the origin to \((1, 1, 1)\), which gives \(\sqrt{3}\). Work out the differences and the square root yourself. For two more free worked examples, check out the 3D Distance Notes.
The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. For more practice, the notes page goes further with extra worked examples and fuller explanations of the ideas behind each step. Use them together to check your answers and to understand why each step works.
See Example 1 Hide Example 1
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the distance between \(P_{1} = \left(1,\; 2,\; 3\right)\) and \(P_{2} = \left(4,\; 6,\; 3\right)\).
Step 2
Step 2 - Write the formula.
In this problem: The distance between two points is the length of the straight line joining them. It comes from Pythagoras' theorem in three dimensions, using the change in each coordinate.
Step 3
Step 3 - Substitute the points into the formula.
In this problem: Replacing the coordinates in \(d = \sqrt{\left(x_{2} - x_{1}\right)^{2} + \left(y_{2} - y_{1}\right)^{2} + \left(z_{2} - z_{1}\right)^{2}}\) gives \(d = \sqrt{\left(4 - 1\right)^{2} + \left(6 - 2\right)^{2} + \left(3 - 3\right)^{2}}\).
Step 4
Step 4 - Work out the differences.
In this problem: Subtracting the matching coordinates gives \(4 - 1 = 3\), \(6 - 2 = 4\) and \(3 - 3 = 0\).
Step 5
Step 5 - Work out the distance.
In this problem: Squaring the differences gives \(3^{2} = 9\), \(4^{2} = 16\) and \(0^{2} = 0\). Adding the squares gives \(9 + 16 + 0 = 25\), and taking the square root gives \(\sqrt{25} = 5\).
Final Answer
See Example 2 Hide Example 2
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the distance between \(P_{1} = \left(0,\; 0,\; 0\right)\) and \(P_{2} = \left(1,\; 1,\; 1\right)\).
Step 2
Step 2 - Write the formula.
In this problem: The distance between two points is the length of the straight line joining them. It comes from Pythagoras' theorem in three dimensions, using the change in each coordinate.
Step 3
Step 3 - Substitute the points into the formula.
In this problem: Replacing the coordinates in \(d = \sqrt{\left(x_{2} - x_{1}\right)^{2} + \left(y_{2} - y_{1}\right)^{2} + \left(z_{2} - z_{1}\right)^{2}}\) gives \(d = \sqrt{\left(1 - 0\right)^{2} + \left(1 - 0\right)^{2} + \left(1 - 0\right)^{2}}\).
Step 4
Step 4 - Work out the differences.
In this problem: Subtracting the matching coordinates gives \(1 - 0 = 1\), \(1 - 0 = 1\) and \(1 - 0 = 1\).
Step 5
Step 5 - Work out the distance.
In this problem: Squaring the differences gives \(1^{2} = 1\), \(1^{2} = 1\) and \(1^{2} = 1\). Adding the squares gives \(1 + 1 + 1 = 3\), and taking the square root gives \(\sqrt{3} \approx 1.73\).
Final Answer
Notes and Practice Mode
Want to understand the method more deeply? The 3D Distance Notes go through the same pattern with extra worked examples and fuller explanations of the ideas behind each step, so you can see why every step works and not just what to do. When you are ready to test yourself, 3D Distance Practice gives you a new problem at Easy, Medium or Hard level, checks your answer and shows the full working whenever you get one wrong. Practice Mode for this calculator is available on the Pro plan.
Login and upgrade to Pro to unlock the full step solution.
Example Problems
Click one to load it into the box and solve it.