Skip to content
Advertisement
Hosinger Special Offer

Distance Formula Calculator

Distance Formula Calculator from Gizcalc helps you estimate results quickly within the Math & Statistics category.

  • Instant results
  • Charts & tables
  • Save & compare
  • Private – runs in your browser
Distance —

Sample inputs are pre-filled so you can see a result quickly. Results are estimates only and may not be accurate because prices, interest rates, taxes, fees, fuel costs, tariffs, market returns, medical costs, and local rules can change. Please verify current values before making financial, tax, legal, medical, or business decisions.

Formula used

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

  • (x₁, y₁, z₁), (x₂, y₂, z₂) = the two points

About the Distance Formula Calculator

What is the Distance Formula Calculator?

The distance formula gives the straight-line (Euclidean) distance between two points. It comes directly from the Pythagorean theorem: the horizontal and vertical differences between the points form the legs of a right triangle, and the distance is its hypotenuse.

Enter the coordinates of two points. Leave both z-values at 0 for a flat 2D problem, or fill them in for 3D space. The calculator shows the distance, each coordinate difference (Δx, Δy, Δz) and the distance measured in the xy-plane alone.

How to use the Distance Formula Calculator

  1. x₁ (sample: 1)
  2. y₁ (sample: 2)
  3. z₁ (leave 0 for 2D) — leave at 0 for a 2D problem. (sample: 0)
  4. x₂ (sample: 4)
  5. y₂ (sample: 6)
  6. z₂ (leave 0 for 2D) — leave at 0 for a 2D problem. (sample: 0)
  7. Press Find Distance (results also refresh as you type). The result card shows the Distance, along with Δx, Δy, Δz and Distance in the xy-plane.

Formula used

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

  • (x₁, y₁, z₁), (x₂, y₂, z₂) = the two points

In 2D the z term is zero, which gives d = √((x₂ − x₁)² + (y₂ − y₁)²).

Worked example

These are the sample values already filled in the calculator above, and the result it returns for them:

InputSample value
x₁1
y₁2
z₁ (leave 0 for 2D)0
x₂4
y₂6
z₂ (leave 0 for 2D)0
ResultValue
Distance5
Δx3
Δy4
Δz0
Distance in the xy-plane5

Tips for using the Distance Formula Calculator

  • The order of the points does not matter, because the differences are squared.
  • This is the “as the crow flies” distance on a flat grid; for places on the Earth's surface use a great-circle (haversine) calculation.
  • Walking along a grid of city blocks covers |Δx| + |Δy| (the Manhattan distance), which is never shorter than the straight-line distance.

Frequently asked questions

Square the difference in x and the difference in y, add them and take the square root. For (1, 2) and (4, 6): √(3² + 4²) = √25 = 5.

Δx and Δy are the two legs of a right triangle whose hypotenuse joins the points, so d² = Δx² + Δy².

Add the squared z-difference too: d = √(Δx² + Δy² + Δz²). Enter the z-coordinates in the calculator.

No. Distance is a length, so it is always zero or positive — zero only when the two points are the same.