2D, 3D & air distance
Distance Calculator
This calculator finds straight-line distance between two points in 2D or 3D using the Pythagorean theorem, or air distance between two lat/lon pairs using the Haversine great-circle formula (R = 6,371 km). Geographic mode includes an interactive map and live formula substitution. Crow-flies only—not driving or walking routes.
By Jeff Beem
Updated
Points & mode
Current calculation
d = √[(x₂−x₁)² + (y₂−y₁)²] = √[(3-0)² + (4-0)²] = 5
How to use this calculator
The form opens in 2D (x, y) with (0, 0) and (3, 4), so Result shows Euclidean distance 5 units. Use the Mode dropdown for 3D coordinates or Geographic (lat/lon).
In Geographic mode, enter decimal degrees or DMS for Point 1 and Point 2, or click the map (first click sets Point 1, second sets Point 2, then they alternate). Defaults are New York to Los Angeles (~3,936 km air distance). Drag pins to refine; lat/lon fields stay in sync.
Result lists great-circle length in km, miles, nautical miles, and other units. The Current calculation panel under Result shows Haversine intermediate values for your coordinates. This is crow-flies distance, not driving or walking routes.
Formulas used
2D (Euclidean): d = √[(x₂−x₁)² + (y₂−y₁)²]
3D (Euclidean): d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]
Geographic: Haversine great-circle (R = 6,371 km)—switch to Geographic mode for the live breakdown.
Reading your results
Match the Mode dropdown to your data: 2D or 3D for flat coordinates, Geographic for lat/lon and the map. Why great-circle routes look curved on flat maps is covered in Why planes fly in curves.
Example: Geographic default NYC → Los Angeles
Current calculation (Geographic only)
Distance Between Two Points: 2D, 3D & Great-Circle
Euclidean distance in flat coordinates or Haversine great-circle between two lat/lon points. Interactive map and live formula substitution in Geographic mode.
What each mode returns
- 2D example:(0, 0) to (3, 4) → d = √(3² + 4²) = 5 (same units as x and y).
- Geographic example:New York (40.7128°, −74.0060°) to London (51.5074°, −0.1278°) → about 5,570 km great-circle. Default NYC–Los Angeles is about 3,936 km.
- Limits:Not road or driving distance. Not ellipsoidal survey precision—use Vincenty/WGS84 when sub-percent accuracy matters. Returns surface arc length, not a chord through the Earth.
Formulas
- 2D:d = √[(x₂−x₁)² + (y₂−y₁)²]
- 3D:Add (z₂−z₁)² under the radical.
- Geographic (Haversine):a = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2)d = 2R × atan2(√a, √(1−a))Equivalent to d = 2R × sin⁻¹(√a); atan2 is preferred when points are very close.
Result and Current calculation panels
- Result (2D/3D):One Euclidean distance labeled in axis units. Standard vs Compact toggles number formatting only.
- Result (Geographic):Same great-circle distance in nautical miles, miles, kilometers, yards, meters, feet, inches, and centimeters.
- Current calculation:Geographic mode only: substituted Haversine with your Point 1 and Point 2 lat/lon, intermediate a, and central angle. Copy results exports mode, coordinates, distance, and breakdown text.
- Map:Geographic mode only: great-circle polyline between pins; clicks set Point 1 then Point 2, then alternate.
Distance Calculator FAQ
How do I calculate distance from latitude and longitude?
Why does this calculator use atan2 instead of arcsin for Haversine?
What is the 3D distance formula?
How do I find distance on a map?
Is the Earth a perfect sphere for these calculations?
What is the difference between Euclidean and geodesic distance?
How do I get latitude and longitude for a city?
Mathematical Reference Note
Calculation Logic: This tool uses standard mathematical algorithms. While we strive for accuracy, errors in logic or user input can result in incorrect data.
Verification: Results should be cross-checked if used for important academic, professional, or personal calculations.
Standard Terms: This tool is provided free of charge and as-is. CalcRegistry provides no warranty regarding the accuracy or fitness of these results for your specific needs.