Distance Calculator
Three distance tools in one: straight-line distance between two points on a plane (2D), between two points in space (3D), or the great-circle distance between two places on Earth from their latitude and longitude — in miles, kilometers, and nautical miles.
Steps
Three kinds of distance
On a flat plane, distance is the Pythagorean theorem in disguise: √(Δx² + Δy²). In three dimensions the same idea just gains a term: √(Δx² + Δy² + Δz²). On the Earth’s surface, straight lines do not exist — the shortest route between two cities follows a great circle, and the haversine formula computes its length from two latitude/longitude pairs, staying numerically stable even for places a few meters apart. Enter coordinates in decimal degrees, with south latitudes and west longitudes negative (New York’s longitude is −74.006).
How it’s calculated
2D: d = √((x₂−x₁)² + (y₂−y₁)²). 3D: add (z₂−z₁)² under the root. Great circle (haversine): a = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2), d = 2R·arcsin √a with R = 6,371 km (Earth’s mean radius); miles = km ÷ 1.609344, nautical miles = km ÷ 1.852. Real journeys differ — this is the shortest surface path, not a road route.
Results update as you type and are for education, not professional advice — double-check any number that matters.
Worked example
2D: from (2, 3) to (7, 15), d = √(5² + 12²) = √169 = 13. 3D: (1, 2, 3) to (4, 6, 15) also gives √(9 + 16 + 144) = 13. Great circle: New York (40.7128, −74.006) to Los Angeles (34.0522, −118.2437) is 3,935.75 km = 2,445.6 miles = 2,125.1 nautical miles — the distance an airliner would fly, not the ~2,790-mile drive.
Common mistakes
- Entering west longitudes as positive — Los Angeles is −118.24, not 118.24; the sign flips the hemisphere.
- Using degree-minute-second values directly — convert to decimal degrees first (34°30′ = 34.5).
- Expecting the great-circle figure to match a road trip — driving distance is always longer.
Where it is used
- Coordinate geometry and vector homework.
- Flight planning and “as the crow flies” distances between cities.
- Games and graphics — distances between objects in 2D or 3D space.
Frequently asked questions
Why is it called the haversine formula?
It is built on the haversine function, hav(θ) = sin²(θ/2), chosen by navigators because it stays accurate for tiny angles where the older law-of-cosines method loses precision on short distances.
How accurate is the great-circle result?
It models Earth as a sphere of radius 6,371 km, which is within about 0.5% of true geodesic distances on the real, slightly flattened planet — roughly ±20 km on a cross-country trip. Surveying-grade work uses the Vincenty formula on an ellipsoid.
What is a nautical mile?
One minute of latitude — 1.852 km, or about 1.1508 statute miles. Ships and aircraft use it because it maps directly onto angular position; one knot is one nautical mile per hour.
How do I find coordinates for a place?
Most map apps show latitude and longitude when you right-click or long-press a location. Use the decimal form, keep 4+ decimal places (each 0.0001° is about 11 m of latitude), and mind the sign conventions.
Does the 2D/3D mode care about units?
No — feet in, feet out; meters in, meters out. Just keep every coordinate in the same unit. Only the lat/long mode assumes specific units (degrees in, km/miles out).