Distance Formula Calculator
Given two points on graph paper or in 3D space, the straight-line distance between them is the hypotenuse of a right triangle built from their coordinate differences. This calculator handles the 2D formula sqrt((x2-x1)^2 + (y2-y1)^2), the 3D extension with a z-term.
How to compute the distance between two points
-
1
Choose dimensions
Pick 2D (x, y) or 3D (x, y, z).
-
2
Enter the coordinates
Fill in both points. Decimals and negatives are fine.
-
3
Read the distance
See the numeric result for your points.
The formulas
2D distance between (x1, y1) and (x2, y2):
d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
3D distance between (x1, y1, z1) and (x2, y2, z2):
d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
Both are direct consequences of the Pythagorean theorem: the squared distance equals the sum of squared differences along each axis.
Worked example
From (3, 4) to (7, 1):
- dx = 7 - 3 = 4
- dy = 1 - 4 = -3
- d = sqrt(16 + 9) = sqrt(25) = 5
In 3D from (1, 2, 3) to (4, 6, 3):
- dx = 3, dy = 4, dz = 0
- d = sqrt(9 + 16 + 0) = sqrt(25) = 5
When to use which
- 2D covers screen coordinates, map distances at small scale (where Earth curvature is negligible), and most homework problems.
- 3D is for simulations, game engines, molecular distances and CAD measurements.
- Great-circle distance on the surface of Earth requires the haversine formula, not the 3D Pythagorean one, because the path follows a curve. Use a dedicated geographic distance tool.
Common mistakes
- Forgetting the square root. Squaring once is not enough; you need to take the root at the end.
- Order of subtraction.
(x2 - x1)vs(x1 - x2)does not matter because the result is squared, but keep it consistent with the textbook you are checking against. - Mixing units. All coordinates must be in the same unit; mixing feet and meters silently gives a meaningless number.
- Negative coordinates. Double-negatives become positives inside the square, so watch the signs on points in quadrants II, III or IV.
Frequently Asked Questions
Because the Pythagorean theorem gives the squared hypotenuse, not the length. The square root undoes the squaring so the result is a plain length in the same unit as the coordinates.
Not with this formula. Earth surface distances need the haversine or Vincenty formulas, which account for curvature. The Pythagorean formula assumes a flat Euclidean space and breaks down at planetary scales.
The Manhattan or taxicab distance is |x2 - x1| + |y2 - y1|, the sum of absolute differences. It represents travel along a grid (like city blocks) rather than a diagonal line and is always greater than or equal to the Pythagorean distance.
No. The coordinates are sent to our server so the distance can be computed, and in the step-by-step mode they are carried in the page link. They are not stored.
Related Tools
BMI Calculator
Calculate body mass index from height and weight. Shows WHO category, healthy-weight range and limitations of BMI.
Social Security Calculator
Estimate a US Social Security retirement benefit from your PIA and claiming age. Compare monthly and annual amounts at 62, FRA 67 and 70.
Age Calculator
Calculate exact age in years, months and days from a birth date, plus total days, hours and the next birthday countdown.
Dog Age Calculator
Convert your dog's age to human years using modern veterinary research. Breed-size aware: small, medium and large dogs age differently.
Amp-Hour Calculator
Work out battery runtime and stored energy from amp-hours, voltage and load current. Get runtime in hours and minutes plus energy in watt-hours and kilowatt-hours.
Concrete Calculator
Calculate how much concrete you need for slabs, footings, columns and walls. Get cubic yards, bag counts and material cost estimates.
Tool available in other languages
- Mesafe Formülü Hesaplayıcısı [TR]
- Calculadora de Fórmula de Distancia [ES]
- حاسبة صيغة المسافة [AR]
- Calculateur de formule de distance [FR]
- Afstandsformule-calculator [NL]
- 거리 공식 계산기 [KO]
- Kalkulator Rumus Jarak [ID]
- Bộ tính toán công thức khoảng cách [VI]
- 距离计算器 [ZH]
- 距離計算機 [JA]
- เครื่องคำนวณสูตรระยะทาง [TH]
- Calculadora da Fórmula da Distância [PT]
- Abstandsformel Rechner [DE]
- Formelkalkylator för avstånd [SV]
- Kalkulator wzoru na odległość [PL]
- Calcolatore della formula della distanza [IT]
- Калькулятор формулы расстояния [RU]