Distance Formula Calculator

Find the distance between two points in 2D or 3D, with the exact radical form, midpoint, slope and steps.

Loading calculator...

Distance formula calculator in short
On this page

How to use the distance formula calculator

1

Choose 2D or 3D

Use 3D when your points have a z coordinate.

2

Enter point 1

Its x₁ and y₁ (and z₁) values.

3

Enter point 2

Its x₂ and y₂ (and z₂) values.

4

Read the distance

See the decimal and exact form with the working.

The distance formula

The distance formula comes from the Pythagorean theorem. The horizontal and vertical gaps between the points are the two legs of a right triangle, and the distance is its hypotenuse.

Distance formulas

2D: d = √((x₂ − x₁)² + (y₂ − y₁)²)

3D: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)

Example 1: (1, 2) and (4, 6)

A 3-4-5 triangle.

  • Δx, Δy 3, 4
  • Square and add 9 + 16 = 25
  • Distance √25 = 5

Example 2: exact radical answers

When the result is not a whole number.

  • (1, 2) to (2, 3) √2 ≈ 1.414214
  • (0, 0) to (6, 6) 6√2 ≈ 8.485281

Example 3: 3D distance

(1, 2, 3) and (4, 6, 15)

  • Δx, Δy, Δz 3, 4, 12
  • Square and add 9 + 16 + 144 = 169
  • Distance 13

Where the distance formula is used

Geometry homework

Find side lengths and check shapes on a grid.

Maps and games

Measure straight-line distance between coordinates.

Physics

Find displacement between two positions.

3D design

Measure between points in space.

Related tools

Find the middle of a segment with the midpoint calculator, the steepness with the slope calculator, or triangle sides with the Pythagorean theorem calculator.

Distance formula calculator FAQ

d = √((x₂ − x₁)² + (y₂ − y₁)²). It gives the straight-line distance between two points.

The differences in x and y are the legs of a right triangle, and the distance is the hypotenuse, so a² + b² = c².

No. Squaring removes negative signs, so distance is always 0 or more.

Add the squared z difference: d = √(Δx² + Δy² + Δz²).

It is 5, because √(3² + 4²) = √25 = 5.

No. Swapping the points changes the signs of the differences, but their squares stay the same.

Embed this calculator on your website

Free to use on any site. Copy the code below and paste it into an HTML block on your page. Please keep the credit link under the calculator.

Show the embed code

Works with WordPress, Wix, Squarespace, Webflow and most site builders that allow HTML. How embedding works.

Estimates, not advice

PureCalculate’s calculators give estimates for planning and education. They aren’t financial, tax or legal advice. Fees and tax rules change, so check the official source before making a decision. Spotted a mistake? Please tell us through the contact page.

Scroll to Top