ToolsVortex
Explore tools
Distance Formula Calculator on ToolsVortex with a worked example filled in

Distance Formula Calculator

ToolsVortex · Math & School

Enter two points in 2D or 3D and get the straight line distance between them, the exact square root form and each step of the distance formula.

Distance
d = 13
Between (−3, 5) and (2, −7)
13Exact form
169d² (sum of squares)
Δx 5, Δy −12Differences
(−0.5, −1)Midpoint

Runs in your browser. Nothing you type is sent anywhere.

Distance Formula Calculator on ToolsVortex with a worked example filled in
Distance Formula Calculator: (−3, 5) to (2, −7) worked out as √169 = 13.

This distance formula calculator is for geometry and algebra students, game developers and anyone measuring a straight line between two coordinates. Type two points on a plane or in space and you get the distance, the exact radical such as 4√5, the sum of squares and the full substitution written out step by step.

What Is the Distance Formula?

The distance formula is d = √((x2 − x1)² + (y2 − y1)²). It gives the straight line length between two points. For example, from (−3, 5) to (2, −7), the differences are 5 and −12, so d = √(25 + 144) = √169 = 13. In 3D, add (z2 − z1)² inside the root.

How Do You Use the Distance Formula Step by Step?

You subtract the coordinates, square each difference, add the squares and take the square root. Each point is written as Cartesian coordinates (x, y), named after René Descartes, who linked algebra and geometry.

2D: d = √((x2 − x1)² + (y2 − y1)²)
3D: d = √((x2 − x1)² + (y2 − y1)² + (z2 − z1)²)

For (1, 2) and (4, 6): Δx = 3 and Δy = 4, so d = √(9 + 16) = √25 = 5. The order of the points does not matter, because squaring removes any minus sign. The answer is the Euclidean distance, the length of the straight line segment, not a path along a grid.

Why Does the Distance Formula Come From the Pythagorean Theorem?

The distance formula comes from the Pythagorean theorem, a² + b² = c², because the horizontal gap Δx and the vertical gap Δy form the two legs of a right triangle, and the distance is the hypotenuse. The points (0, 0) and (3, 4) make the classic 3, 4, 5 triangle. If you already know the two side lengths, the Pythagorean theorem calculator solves the triangle directly, and the slope calculator gives the steepness of the same line, rise ÷ run.

Point 1Point 2d²Distance
(0, 0)(1, 1)2√2 ≈ 1.4142
(0, 0)(3, 4)255
(2, 3)(6, 11)804√5 ≈ 8.9443
(2, −1)(−4, 7)10010
(−3, 5)(2, −7)16913
(0, 0, 0)(1, 1, 1)3√3 ≈ 1.7321
(0, 0, 0)(2, 3, 6)497
(−2, 1, 4)(3, −3, 6)453√5 ≈ 6.7082
(1, 2, 3)(4, 6, 15)16913

How Do You Find the Distance Between Two Points in 3D?

You find the 3D distance by adding a third squared difference for the z coordinate, then taking the square root of all three. It is the Pythagorean theorem used twice: first across the floor, then up to the height. From (0, 0, 0) to (2, 3, 6), d = √(4 + 9 + 36) = √49 = 7. Pick the 3D chip in the tool to show the z boxes.

How Do You Write the Answer in Simplest Radical Form?

You write it in simplest radical form by taking the largest perfect square out of the number under the root. √80 = √(16 × 5) = 4√5, which is about 8.9443. Teachers often ask for this exact form instead of a rounded decimal. The tool shows it when d² is a whole number, and the square root calculator simplifies any other root.

Worked Example

A hiker plots two waypoints on a grid map in kilometres: camp at (−3, 5) and a lake at (2, −7). Enter both and the tool shows d = 13, with Δx 5 and Δy −12. The working line reads √((2 − (−3))² + (−7 − 5)²) = √(25 + 144) = √169 = 13, so the lake is 13 km away in a straight line, and the halfway point is (−0.5, −1). Switching to 3D with (−2, 1, 4) and (3, −3, 6) gives d² = 45 and an exact answer of 3√5 ≈ 6.7082.

How Do You Use the Distance Formula Calculator?

  1. Pick 2D or 3D

    Choose 2D for points on a flat graph, or 3D to add a z coordinate.

  2. Enter point 1

    Type x1 and y1 (and z1 in 3D). Negatives and decimals work.

  3. Enter point 2

    Type x2 and y2 (and z2). The distance updates as you type.

  4. Read the distance and steps

    The big result is the distance; the boxes show the exact root, d², differences and midpoint.

How to use the Distance Formula Calculator, steps 1 to 4 numbered on the tool
The numbers on the picture match the steps above.

Frequently Asked Questions

What is the distance between (0, 0) and (3, 4)?

The distance is 5. The differences are 3 and 4, so d = √(3² + 4²) = √(9 + 16) = √25 = 5. This is the well-known 3, 4, 5 right triangle.

Can the distance between two points be negative?

No. Distance is never negative because each difference is squared before adding, and the square root of a sum of squares is 0 or more. Swapping the two points gives exactly the same answer.

What does d squared mean in the result?

d² is the sum of the squared differences before the square root is taken. For (2, 3) and (6, 11), d² = 16 + 64 = 80. Comparing d² values is a quick way to see which of two distances is longer.

Is the distance formula the same as Manhattan distance?

No. The distance formula gives the straight line Euclidean distance. Manhattan distance adds the absolute differences, like walking along city blocks. From (0, 0) to (3, 4), Manhattan distance is 7, but the straight line is 5.

How do I find the distance on a map with latitude and longitude?

The flat distance formula is only accurate for short distances on a local grid. For points far apart on Earth you need the great circle method, such as the haversine formula, because the surface is curved.

What happens if both points are the same?

The distance is 0, since every difference is 0. The tool shows d = 0 and notes that the two points match. There is no line segment, so the midpoint is just the same point.

Sources and Further Reading

Related Tools

Last reviewed: October 2026