Math Solver Free

Distance Formula Calculator

Distance between points in 2D or 3D — instantly and free.

How the Distance Formula Works

This distance formula calculator finds the straight-line distance between two points, whether they sit on a flat 2D plane or in 3D space. The formula behind it is the Pythagorean theorem in disguise: the horizontal gap between the points forms one leg of a right triangle, the vertical gap forms the other leg, and the distance you want is the hypotenuse. Enter the coordinates, and the tool shows the substituted values, the exact radical answer, and the decimal — so you can follow the working, not just copy a number.

2D and 3D Versions

In 2D you square two differences; in 3D you square three. The pattern extends to any number of dimensions — just keep adding squared coordinate differences under the square root.

Every symbol has a concrete meaning. d is the distance itself, measured in the same units as the coordinates. (x₁, y₁) are the coordinates of the first point and (x₂, y₂) those of the second — the subscript simply labels which point a coordinate belongs to. x₂ − x₁ is the horizontal change between the points, y₂ − y₁ the vertical change, and in 3D z₂ − z₁ is the change in depth. The square root at the end converts the summed squares back into a length.

Exact vs. Decimal Answers

Many distances are irrational (like √50). Geometry classes often want the exact radical form, while applied problems want the decimal — this tool shows both.

How to Use the Calculator

  1. Pick the dimension: click “2D points” for flat coordinates, or “3D points” to reveal the extra z₁ and z₂ boxes.
  2. Enter the first point: type its coordinates into the x₁ and y₁ fields (and z₁ in 3D mode).
  3. Enter the second point: fill in x₂ and y₂ (and z₂) the same way — the order does not matter.
  4. Press Calculate Distance: the result appears as d ≈ a decimal, followed by the substitution steps and the exact form √n, so you can check each line against your own working.

Worked Example 1: From (2, 3) to (6, 6) in 2D

  1. Label the points: (x₁, y₁) = (2, 3) and (x₂, y₂) = (6, 6).
  2. Find the horizontal gap: Δx = 6 − 2 = 4. This becomes one leg of the right triangle.
  3. Find the vertical gap: Δy = 6 − 3 = 3. This is the other leg.
  4. Square each gap: 4² = 16 and 3² = 9.
  5. Add and take the root: d = √(16 + 9) = √25 = 5.

Verify it with Pythagoras directly: 3² + 4² = 9 + 16 = 25 = 5², so the triangle is the classic 3-4-5 right triangle and the answer 5 is exact — no rounding anywhere. Whenever the two gaps are 3 and 4, in either order and with any signs, the distance is guaranteed to be 5. That pattern is worth recognising on sight, because it shows up constantly in homework, in exams, and on job sites.

Worked Example 2: From (0, 0, 0) to (2, 3, 6) in 3D

  1. Find the three gaps: Δx = 2 − 0 = 2, Δy = 3 − 0 = 3, Δz = 6 − 0 = 6.
  2. Square each gap: 2² = 4, 3² = 9, and 6² = 36.
  3. Add the squares: 4 + 9 + 36 = 49.
  4. Take the square root: d = √49 = 7.

You can double-check a 3D answer by applying Pythagoras twice. First, the diagonal across the floor plane is √(2² + 3²) = √13. Then that diagonal and the height 6 form a second right triangle: d = √(√13² + 6²) = √(13 + 36) = √49 = 7 — the same result, as it must be. Imagine the origin as one corner of a room and (2, 3, 6) as a point 2 metres along, 3 metres across, and 6 metres up: the straight cable run between them is exactly 7 metres.

Where You Actually Use This

Any time a map gives you coordinates instead of roads: the straight-line (“as the crow flies”) distance between two GPS points, the diagonal brace needed to square a deck frame, the range between a game character and a target on a grid, or the displacement in a physics problem. In 3D it measures a drone's direct flight path between two waypoints, or the longest rod that fits diagonally inside a storage box. If the two points are cities on a real map, remember this is the flat-plane version — for long distances over the curved Earth, navigation tools switch to great-circle formulas.

Common Mistakes

  • Forgetting the final square root. The sum 16 + 9 = 25 is d², not d. Reporting 25 instead of 5 is the single most common slip — always finish by taking the root.
  • Squaring the sum instead of summing the squares. (Δx + Δy)² is not Δx² + Δy². Each gap must be squared separately before anything is added.
  • Pairing the wrong coordinates. Subtract x from x and y from y. Mixing in a y-value where an x belongs — or forgetting the z-difference entirely in 3D mode — quietly produces a plausible-looking but wrong answer.

The same right-triangle idea powers our Pythagorean theorem calculator — and you can check the arithmetic with the four-function calculator.

Frequently Asked Questions

What is the distance formula?

The distance formula is d = √[(x₂−x₁)² + (y₂−y₁)²]. It is the Pythagorean theorem rearranged: the horizontal gap between the two points is one leg of a right triangle, the vertical gap is the other leg, and the distance you want is the hypotenuse. It works for any two points on a flat coordinate plane, whatever their coordinates.

How do you find distance in 3D?

In three dimensions you add one more squared gap for the z-coordinates: d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]. Each coordinate contributes independently, so the 3D formula is simply the 2D formula with an extra term under the same square root. Switch the calculator above to 3D points mode and it adds the z-term for you automatically.

Does the order of the two points matter?

No. Swapping the points only changes the sign of each difference: (x₁−x₂) instead of (x₂−x₁). Because every difference is squared, the sign disappears and the distance comes out identical either way. This is why distance is never negative, and why you can enter the two points in whichever order is convenient — the calculator returns the same answer.

What is the difference between distance and displacement?

Distance is the total length of the path actually travelled, and it is always positive. Displacement is the straight-line change in position from start to finish, and it also carries a direction. This formula computes the magnitude of the displacement — the straight-line gap — not the length of any winding route, which is why road distances between two places are always longer.

Why is my answer a square root like √34?

Most pairs of points do not form a neat Pythagorean triple, so the squared gaps add to a number that is not a perfect square, and the distance stays as an exact radical such as √34 ≈ 5.83. Keep the radical form when a class wants an exact answer; use the decimal when you need a measurement. The calculator displays both forms.

Is this calculator free?

Yes — the distance formula calculator is completely free, with no account, sign-up, or download needed. Enter your two points, choose 2D or 3D, and the distance is calculated instantly in your browser together with the substitution steps, in both exact radical form and decimal form, so you can check your own working line by line.

Related Tools & Guides

About the MathSolverFree Team

The MathSolverFree Team builds and maintains the calculators and step-by-step solvers on this site. Every tool is checked against worked textbook examples before it is published, and the method behind each solver is written out in full — in the worked examples on the page and in our guides — so you can see exactly how an answer is reached, not just the answer itself.

How we build and test our tools·More about the team