The answer: Paste both coordinate pairs into a haversine calculator such as our free two-pin tool and you get the straight-line distance in seconds. That number is the great-circle distance along the Earth's surface, not driving distance, and it is typically accurate to about 0.3%.
Table of contents
Two pairs of numbers sit on your screen, and the question between them is simple: how far apart are these two places? Maybe you pulled coordinates from a photo with location data, a delivery address, or a GPX track, and now you want a number in kilometres or miles.
The short answer: paste both pairs into our free distance between pins tool and read the result. The longer answer, which this guide covers, is what that number actually means, how to compute it yourself, and which mistakes make it wrong.
What “distance between coordinates” actually means
Every coordinate distance you see online is a great-circle distance: the shortest path between two points along the surface of a sphere. Picture a string pulled tight over a globe. That string is what the math measures.
Three things follow from that definition:
- It is a straight line, not a route. Roads curve, ferries zigzag, and borders force detours. A 60 km straight line can easily be an 80 km drive.
- It ignores hills. The formula flies over terrain. For mountain trips the ground distance is a little longer than the computed one.
- It assumes a smooth Earth. The real planet bulges slightly at the equator, but the spherical model used by the haversine formula keeps the error around 0.3% for everyday distances, as the well-known Movable Type lat/long reference explains.
None of this makes the number useless. For delivery zones, search radiuses, hiking estimates, and “is it closer to drive from A or from B” questions, the straight-line distance is exactly the right first number. Just do not confuse it with travel time.
Method 1: the two-pin tool (fastest)
If you want the answer in ten seconds, use the tool built for this page:
- Open the distance between pins tool.
- Drag pin A and pin B to your two places, or type both coordinate pairs into the boxes.
- Read the distance in km and miles, plus the bearing and midpoint.
Everything runs in your browser, so nothing is uploaded, and the share link encodes both pins into the URL for later. There is no sign-up and no location permission prompt, because the tool never needs to know where you are.
This method suits nearly everyone: checking how far a listing is from your office, settling a bet about which of two cities is closer, or turning photo GPS data into a real distance.
Method 2: Google Maps Measure distance (no new tab)
If you already live in Google Maps, it has a built-in measuring mode, documented in Google’s own help page:
- On a computer, open Google Maps and right-click your starting point.
- Select Measure distance.
- Click anywhere to add your second point (and more points for a path).
- Read the total at the bottom in miles and kilometres. Drag points to adjust; click a point to remove it.
On phones the flow differs slightly: drop a pin, swipe up the place sheet, and look for the measure option. One caveat from Google: Lite mode (the lightning-bolt mode) cannot measure distance, so switch to full Maps if the option is missing.
Google’s version is convenient, but it keeps the result inside Google Maps. There is no shareable measurement link, and multi-stop paths measure point to point, still as straight segments rather than road routes.
Method 3: the haversine formula (spreadsheet or code)
For repeated calculations, learn the formula once and reuse it forever. Given point 1 (lat1, lon1) and point 2 (lat2, lon2) in degrees:
- Convert everything to radians: multiply degrees by pi/180.
- Compute
a = sin²(lat diff / 2) + cos(lat1) × cos(lat2) × sin²(lon diff / 2). - Compute
c = 2 × atan2(sqrt(a), sqrt(1 − a)). - Multiply by the Earth’s mean radius:
d = 6,371,000 × cmetres.
In JavaScript, the whole thing is about ten lines, and the same structure appears in reference implementations such as GeoDataSource’s distance routine:
const R = 6371e3; // metres
const p1 = lat1 * Math.PI / 180, p2 = lat2 * Math.PI / 180;
const dp = (lat2 - lat1) * Math.PI / 180;
const dl = (lon2 - lon1) * Math.PI / 180;
const a = Math.sin(dp / 2) ** 2 +
Math.cos(p1) * Math.cos(p2) * Math.sin(dl / 2) ** 2;
const d = R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
Why haversine instead of the simpler spherical law of cosines? Numerical stability. At short distances the cosine formula subtracts two nearly equal numbers and loses precision, while the haversine form stays accurate down to metres. The Wikipedia treatment of the formula walks through the derivation for the mathematically curious.
A worked example
Bratislava (48.1486, 17.1077) to Vienna (48.2082, 16.3738):
- Latitude difference: 0.0596 deg. Longitude difference: −0.7339 deg.
- In radians: dp = 0.00104, dl = −0.01281.
a≈ 0.00001851,c≈ 0.008604.d= 6,371,000 × 0.008604 ≈ 54,818 metres, about 54.8 km or 34.1 miles.
Try the same pair in the two-pin tool. You should land within rounding distance of this number; if you do not, one of the inputs differs. If you need the middle of the two points instead of the gap, our halfway meeting guide shows how to turn that midpoint into a fair venue.
How precise do your coordinates need to be?
Each decimal place in decimal degrees is worth roughly ten times less ground:
| Decimals | Example | Resolution |
|---|---|---|
| 2 | 48.15, 17.11 | about 1.1 km, city level |
| 3 | 48.149, 17.108 | about 110 m, street level |
| 4 | 48.1486, 17.1077 | about 11 m, building level |
| 5 | 48.14859, 17.10774 | about 1.1 m, doorway level |
| 6 | 48.148594, 17.107744 | about 11 cm, beyond phone GPS |
Four decimals are plenty for distance estimates. Six decimals look impressive but exceed what a phone GPS chip can honestly deliver, so treat them as exact-looking guesses. If your source mixes formats (degrees-minutes-seconds vs decimal), convert everything to decimal degrees first; our GPS coordinates parser tool does that cleanup.
Five mistakes that break the measurement
- Swapped latitude and longitude. Latitude comes first and stays within −90 to 90. If your “latitude” is 120, the pair is swapped.
- Comma decimals. Much of Europe writes 48,14 but every calculator expects 48.14. Replace commas with dots before pasting.
- Degrees fed to trig functions. Code libraries want radians. Forgetting the conversion is the classic one-line bug behind absurd results.
- Measuring at the wrong zoom. On a zoomed-out map, one pixel can span hundreds of metres. Zoom in fully before placing pins.
- Comparing against a road distance. If your result is 20% shorter than a routing app, both numbers are probably right: one is a straight line, the other follows asphalt.
When you need more than a straight line
Straight-line distance answers “how far apart”, but some questions need a different tool. For delivery and commute planning, draw an area with the radius map tool instead of measuring single pairs. For driving time and fuel, run the same endpoints through a routing service. For legal boundaries, construction, or anything where centimetres carry liability, none of these browser methods qualify: hire a licensed surveyor with proper equipment.
For everything else, two coordinates and ten seconds are all it takes. Open the distance between pins tool, drop your pins, and you have your number.
Frequently asked questions
How do I find the distance between two GPS coordinates?
Enter both latitude and longitude pairs into a haversine calculator, for example our free two-pin distance tool, and read the straight-line result. The haversine formula converts both points to radians and returns the shortest path along the Earth's surface. For a quick check inside an app you already use, Google Maps has a Measure distance option on right-click.
Is the distance between coordinates driving distance?
No. Coordinate math returns straight-line (great-circle) distance, which ignores roads, terrain, water, and borders. A real drive between the same two points is almost always longer. Use the straight-line number for planning radiuses and rough estimates, and a routing service for travel time.
What is the haversine formula in simple terms?
It is a short equation that turns two latitude and longitude pairs into a surface distance. It computes an intermediate value from the differences in latitude and longitude, converts that to a central angle, and multiplies by the Earth's mean radius (6,371 km). It stays numerically stable even for very short distances, which is why it beat older cosine-based formulas.
How accurate is a coordinate distance calculation?
The spherical Earth model behind the haversine formula introduces up to about 0.3% error, which is negligible for everyday use. Pin placement and coordinate precision matter far more: four decimal places resolve about 11 metres, five about 1 metre. If you need legal-grade precision, hire a surveyor.
Why do two tools show slightly different distances?
They usually assume a slightly different Earth radius (6,371 km vs 6,378 km), round coordinates to different decimal places, or one of them snaps your input to the nearest road. Differences under half a percent are normal and come from the model, not from a bug.