Distance Calculator
A distance calculator like this one finds the straight-line distance between two GPS coordinates, or between two points on a 2D or 3D coordinate plane.
Distance between two GPS coordinates
Distance between two points (2D)
Distance between two points (3D)
How to use this distance calculator
- Pick the card that matches what you’re measuring — GPS coordinates, 2D points, or 3D points.
- Enter the values for Point A and Point B.
- Click “Calculate” to see the distance, updated instantly.
How does the distance calculator handle GPS coordinates?
To calculate the straight-line distance between two points on the Earth’s surface, the Haversine formula is used. This accounts for the curvature of the Earth, unlike a simple flat-map calculation — a factor NOAA’s geodesy tutorial covers in more depth.
distance = 2 × R × asin(√a)
Here, R is the mean radius of the Earth, 6,371 km (about 3,959 miles), φ is latitude, and λ is longitude. Note: this is the “as the crow flies” distance, not the actual travel distance by road, which is always longer due to turns and obstacles.
Distance between two points (2D and 3D)
For points on a flat plane or in space, the classic Pythagorean theorem is used, extended to multiple dimensions.
Distance calculator examples
A few worked examples show how the formulas behave in practice, using the same math as the distance calculator above:
- The default values, New York to Boston, give about 306.1 km (190.2 miles) as the crow flies.
- London to Paris is about 213.5 miles (343.6 km) as the crow flies — a GPS/haversine calculation.
- A 2D point at (0, 0) to (6, 8) is exactly 10 units away.
- A 3D point at (1, 2, 2) to (4, 6, 14) is exactly 13 units away.
Common mistakes when using a distance calculator
- Confusing straight-line and travel distance. GPS/haversine results are “as the crow flies”; actual driving, walking, or flight-path distance is almost always longer.
- Mixing up degrees and radians. The Haversine formula needs radians — forgetting to convert from degrees is one of the most common scripting mistakes with this formula.
- Dropping the sign on coordinates. Southern Hemisphere latitudes and Western Hemisphere longitudes are negative; dropping the minus sign can put a point on the wrong side of the planet.
- Using flat-plane Pythagoras for GPS coordinates. The Pythagorean theorem is correct for 2D/3D points, but not directly for latitude and longitude, since a degree of longitude covers a different real-world distance depending on latitude.
Distance calculator: units, input and accuracy
The distance calculator works in kilometers first and converts the result exactly: 1 mile is 1.609344 km and 1 nautical mile is 1.852 km, so the three boxes always agree. Type latitude and longitude in decimal degrees, with a decimal point or a decimal comma; negative values are south of the equator or west of Greenwich. A latitude outside −90 to 90 or a longitude outside −180 to 180 shows a message instead of a result, and each card recalculates as you type.
The haversine formula treats the Earth as a sphere with the mean radius of 6,371 km. The real Earth is slightly flattened: according to the NASA Earth Fact Sheet its equatorial radius is 6,378.137 km and its polar radius 6,356.752 km. That is why this distance calculator can differ from the true surface distance by up to about half a percent, which is fine for comparing cities but not for surveying. To turn kilometers into miles on their own, use the kilometers to miles converter; to see how long a trip takes at a given speed, use the speed, distance and time calculator; and for other length units, the length converter.
Frequently Asked Questions
Why does the distance calculator show nautical miles?
Sea and air navigation measure distance in nautical miles, and one nautical mile is exactly 1,852 meters. The distance calculator shows it next to kilometers and miles so pilots and sailors can read the same great-circle result directly.
Is the GPS distance the same as the travel distance?
No. The calculated distance is the straight-line distance “as the crow flies”, while the actual travel distance by road, rail, or on foot is almost always longer due to turns, obstacles, and the shape of the infrastructure.
Where do I find the latitude and longitude of a location?
These can be found in most map and navigation apps, usually by clicking on a location or searching for the coordinates of an address.
Can I also enter negative coordinates?
Yes. Negative latitudes are in the Southern Hemisphere, and negative longitudes are west of the prime meridian (for example, in North and South America).