Distance, midpoint & circles
Distance Calculator
Calculate the straight-line distance between two points in 2D or 3D, or find the geographic distance between two locations using latitude and longitude. Uses the Haversine formula for great-circle (as-the-crow-flies) distance. Results in kilometers, miles, or nautical miles.
By Jeff Beem
Updated
Points & mode
Current calculation
d = √[(x₂−x₁)² + (y₂−y₁)²] = √[(3-0)² + (4-0)²] = 5
Using this calculator
Choose 2D or 3D for Cartesian coordinates (Euclidean distance), or Geographic for lat/lon (great-circle distance). For geo, use decimal degrees; the map draws the great-circle arc between the two points on a Mercator basemap. Drag markers or click to set points. For definitions and coordinate systems, see the article below.
Formulas used
2D (Euclidean): d = √[(x₂−x₁)² + (y₂−y₁)²]
3D (Euclidean): d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]
Geographic (Haversine, great-circle): Earth radius R = 6,371 km. Distance in km: d = 2R × atan2(√a, √(1−a)), where a = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2) (angles in radians).
Three modes
(0, 0) to (3, 4) is 5 in 2D; New York to London is about 5,570 km on the sphere. Pick the mode that matches your coordinate type, then read the result in your own units.
Choosing a mode
Two places on Earth
Using the map
Crow-flies, not driving
Distance Calculator: 2D, 3D & Great-Circle Distance
(0, 0) to (3, 4) is 5 units in 2D; NYC (40.71° N, 74.01° W) to London (51.51° N, 0.13° W) is about 5,570 km great-circle. Flat Pythagorean or spherical Haversine, with map pins in Geographic mode.
How distance is computed
- 2D worked example:Point 1: (0, 0), Point 2: (3, 4) →d = √(3² + 4²) = 5Same units as x and y.
- Geographic worked example:40.7128° N, 74.0060° W (New York) to 51.5074° N, 0.1278° W (London) is about 5,570 km Haversine. Tokyo to Los Angeles works out near 8,815 km on the same model. The curve looks longer on a Mercator map because flat maps stretch high latitudes.
- What this misses:Road or driving distance, which needs a routing service. Ellipsoidal Vincenty/WGS84 geodesics, usually within ~0.5% of this sphere model on long routes. Geographic mode returns the surface arc, not the chord through the planet.
- Also on screen:DMS and decimal lat/lon stay in sync with draggable markers; all math runs locally in your browser.
Euclidean vs great-circle
- 2D:d = √[(x₂−x₁)² + (y₂−y₁)²]Example: Δx = 3, Δy = 4 → d = 5.
- 3D:Add (z₂−z₁)² under the radical. Same units as your axes.
- Geographic (Haversine):Shortest surface arc, not a straight line through the planet.d = 2R × atan2(√a, √(1−a))witha = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2)(φ, λ in radians). Crow-flies city pairs match flight planning at this precision; survey work may need an ellipsoid solver.
Coordinates and units
Distance Calculator FAQ
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.