Distance Calculator
Enter any two coordinates in decimal degrees to get the true great-circle distance between them — in kilometers and miles — free and instant.
Two points on Earth
๐ Point A
๐ Point B
Pick points on a map
Blue pin is Point A, orange pin is Point B. The dashed line is a straight connector on the map; the distance shown is the great-circle distance.
Great-circle distance
- The default pair tells the story: New York (40.7128, −74.0060) to Los Angeles (34.0522, −118.2437) is 3,935.75 km — 2,445.56 miles, or 9.83% of Earth’s circumference.
- The haversine formula turns the latitude and longitude differences into a central angle, then multiplies by Earth’s radius (6,371 km): the great-circle path it measures is the true shortest route over the sphere.
- Coordinates go in as decimal degrees or as degrees / minutes / seconds, and the answer can be shown in kilometers, miles, meters, feet or nautical miles.
๐ Private by design โ every calculation runs in your browser. Nothing you type is sent or stored anywhere.
One distance calculator, three kinds of distance
Earth, plane, or space โ three geometries, three honest answers, one page.
Almost every distance question sounds identical โ “how far is it from here to there?” โ but it hides three different geometries. On the surface of the Earth, the honest answer is the great circle distance: the shortest path over the sphere, which is why I describe the Earth mode above as a great circle distance calculator. On a flat map, a floor plan, or a game grid, the answer is the straight-line distance between two coordinates. And in three dimensions โ a drone’s flight volume, a CAD model, a physics problem โ the same idea simply gains a third axis. I built this page so one distance calculator answers all three: it works as a distance between two points calculator on a plane, a 3d distance calculator in space, and a lat long distance calculator (a latitude longitude distance calculator, if you prefer the long form) on the globe.
People often arrive here looking for a distance between two cities calculator. The number that search wants is exactly what the Earth mode computes โ but the mode asks for the cities’ coordinates rather than their names. So further down this page I have printed a table of the city pairs people ask about most, with each city’s latitude and longitude ready to copy and paste. That is also why this page serves as a distance between coordinates calculator in both senses of the word “coordinates”: latitude and longitude on the Earth, and plain x, y (and z) values on a grid.
In the plane modes, the tool applies the schoolbook distance formula to your coordinates and reports the result as a straight-line (Euclidean) distance โ which makes those modes a distance formula calculator and, in the strict mathematical sense, a euclidean distance calculator. Both plane modes also report the midpoint of your two points, so together they work as a distance and midpoint calculator: how far apart the points are, and exactly where “halfway between them” is.
Which mode should you use? If your points are places on Earth and you have their latitude and longitude, stay in Earth mode โ it is the only one that respects the planet’s curve. If your points live on a flat grid โ pixels, meters on a site plan, squares on a game map โ the 2D tab is your 2d distance calculator. If height or depth separates your points as well, use the 3D tab. Choosing the mode is the one decision that separates a right answer from a confident wrong one, so I ask you to make it deliberately.
One last orientation note, on units. In Earth mode the result panel always shows kilometers and miles side by side, and the unit menu can restate the headline figure in meters, feet, or nautical miles. The nautical mile deserves its place here: one nautical mile is exactly 1.852 km and equals one minute of latitude, so it is the one unit that belongs to the coordinate grid itself โ which is why sailors and pilots still navigate in it. In the plane modes the mathematics is unit-agnostic: the menu simply labels your result, so keep every coordinate in the same unit (all meters, or all feet) and the distance comes out in that unit.
Your route on the globe
This live globe draws the true great-circle arc between your two pins โ it updates as you type.
Distance between two cities: the pairs people ask about most
Great-circle distances for famous city pairs โ with the coordinates printed, ready to paste into the calculator above.
Here is the honest part first. The winners of the “distance between two cities” search usually let you type two city names; this page cannot do that, and I will not pretend otherwise. What it can do is give you the coordinates, because a city’s coordinates are all the Earth mode needs. Find your pair below, copy each city’s latitude and longitude into the Point A and Point B fields, and the calculator returns the same great-circle distance printed here โ its own default example, New York to Los Angeles, sits at the top of the table.
| From | Coordinates | To | Coordinates | Distance (km) | Miles |
|---|---|---|---|---|---|
| New York | 40.7128, −74.0060 | Los Angeles | 34.0522, −118.2437 | 3,935.75 | 2,445.56 |
| New York | 40.7128, −74.0060 | London | 51.5074, −0.1278 | 5,570.22 | 3,461.17 |
| London | 51.5074, −0.1278 | Paris | 48.8566, 2.3522 | 343.56 | 213.48 |
| Chicago | 41.8781, −87.6298 | Houston | 29.7604, −95.3698 | 1,515.81 | 941.88 |
| Sydney | −33.8688, 151.2093 | Melbourne | −37.8136, 144.9631 | 713.43 | 443.30 |
These are straight-line distances over the Earth’s surface โ the distance as the crow flies. They are not driving distances: roads bend, detour around terrain, and stop at oceans, so the same trip by car is always longer (New York to Los Angeles is roughly 4,500 km by road, against 3,935.75 km on the great circle). Use the great-circle figure where the shortest surface path is the honest answer: map radii and delivery zones, signal and radio reach, geography questions, and comparing how far apart two places truly are. The result panel always shows kilometers and miles side by side, and the unit menu can restate the headline figure in meters, feet, or nautical miles โ New York to Los Angeles, for instance, is about 2,125 nautical miles.
Keep exploring
Three companion tools for measuring the world.
How it works
Three steps from coordinates to true distance.
Enter two points
Type latitude and longitude in decimal degrees for Point A and Point B.
We run haversine
The formula measures the central angle between the points on a sphere of radius 6,371 km.
See both units
The distance appears in kilometers and miles, plus its share of Earth’s full circumference.
How to calculate distance between two points
The method changes with the geometry. Here is each one, with the numbers worked in full.
On a plane (2D). The distance formula is the Pythagorean theorem wearing a coat: take the horizontal difference and the vertical difference between the points, square both, add them, and take the square root.
Worked example โ from (−1, 2) to (3, 5): the differences are 3 − (−1) = 4 across and 5 − 2 = 3 up, so d = √(16 + 9) = √25 = 5 exactly. The 2D tab also reports the squared distance (25, the value before the root is taken) and the midpoint, ((−1 + 3)/2, (2 + 5)/2) = (1, 3.5) โ the point exactly halfway along the segment. That is the whole method behind every distance between two points calculator, this one included.
The midpoint, briefly. The midpoint formula simply averages the coordinates: ((x₁ + x₂)/2, (y₁ + y₂)/2) in 2D, with a z-average added in 3D. Distance tells you how far apart two points are; the midpoint tells you where “between them” actually is โ the meeting point, the center of a segment, the halfway mark on a map grid. The midpoint belongs to the flat plane modes: on the curved Earth, a halfway point is a different calculation, and this page does not dress its Earth-mode answer up as one.
In space (3D). For the distance between two points in 3d, the same root gains one more squared difference โ the depth:
Worked example โ from (1, 2, 3) to (4, 6, 8): the differences are 3, 4, and 5, so d = √(9 + 16 + 25) = √50 ≈ 7.0711, with squared distance 50 and midpoint (2.5, 4, 5.5). I reach for the 3D tab when a straight line cuts through a room, a warehouse, or a flight volume rather than across a surface โ anywhere the shortest path ignores the floor.
On Earth. The flat formula breaks on the planet: one degree of longitude spans 111.19 km at the equator but only about 78.63 km at 45° latitude, because the meridians converge. So the Earth mode uses the haversine formula on a sphere of radius 6,371 km: convert both points to radians, feed the latitude and longitude differences into the haversine expression (written out in full in the math section below), and multiply the resulting central angle by 6,371. For New York to Los Angeles that gives 3,935.75 km โ 9.83% of the way around the planet. My rule of thumb: if your coordinates are latitude and longitude, use Earth mode; if they are plain x, y (and z), use the flat modes.
The math behind great-circle distance
A straight line on a flat map is wrong for long distances โ Earth curves. The haversine formula computes the shortest path over the sphere’s surface (the great circle) from the latitudes ฯ and longitudes ฮป of the two points, with Earth radius R = 6,371 km:
Worked example โ New York (40.7128, โ74.0060) to Los Angeles (34.0522, โ118.2437):
| Step | Calculation | Result |
|---|---|---|
| ฮฯ, ฮฮป | โ6.6606ยฐ, โ44.2377ยฐ in radians | โ0.11625, โ0.77209 |
| a | sinยฒ(โ0.0581) + cos(0.7106) ยท cos(0.5943) ยท sinยฒ(โ0.3860) | 0.09236 |
| Distance | 2 ร 6,371 ร atan2(โ0.09236, โ0.90764) | 3,935.75 km |
| Miles | 3,935.75 ร 0.621371 | 2,445.56 mi |
Two honest footnotes. First, why haversine and not the simpler spherical law of cosines: both return the same great circle distance, but the law of cosines loses precision for very short distances โ its answer depends on the arccosine of a number extremely close to 1 โ while the haversine form stays accurate down to a few meters, which is why GPS-era tools standardized on it. Second, the spherical assumption itself: the Earth bulges slightly at the equator, so on the longest routes an ellipsoidal (geodesic) calculation can differ from this page’s figure by up to about 0.5%. I take the sphere deliberately โ one radius, one formula, and arithmetic you can check by hand.
Go deeper
The details that separate a rough guess from a trustworthy measurement.
On a flat grid, distance is just the Pythagorean theorem on degree differences โ and it is badly wrong past a few hundred kilometers. One degree of longitude is 111 km at the equator but only about 78 km at 45ยฐ latitude, because the meridians converge toward the poles. The haversine formula handles this automatically: it works in 3D on the sphere, so the NYCโLA result (3,935.75 km) reflects the true curved path, not a flat projection’s distortion.
- Accuracy: haversine treats Earth as a perfect sphere of radius 6,371 km. Real Earth is slightly flattened, so results can differ from geodetic (Vincenty) formulas by up to about 0.3โ0.5% on long routes โ a few kilometers on a transcontinental trip.
- Not driving distance. This is the shortest path “as the crow flies.” Roads, borders, and oceans make real travel much longer โ the driving route NYC to LA is roughly 4,500 km.
- Coordinates matter. City centers vs. airports can differ by 30+ km, so enter the exact coordinates you care about.
On a flat plane, distance is the Pythagorean theorem: d = √((x₂−x₁)² + (y₂−y₁)²). From (0, 0) to (2, 3): √(4 + 9) = √13 ≈ 3.6056. Use the 2D mode above for maps, floor plans, game coordinates, or any flat grid. The unit you select labels the result — just keep your coordinates in that unit.
In three dimensions the theorem extends naturally: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). From (0, 0, 0) to (1, 1, 1): √3 ≈ 1.7321. The 3D mode is handy for CAD measurements, drone flight paths, and molecular distances — anywhere the straight line cuts through space, not across a surface.
Older maps and GPS devices often give coordinates as degrees, minutes, and seconds. Convert with decimal = degrees + minutes÷60 + seconds÷3600 (keep the sign on the degrees). Example: 40° 42′ 46″ N = 40 + 42/60 + 46/3600 = 40.7128°. Toggle the DMS input above and the calculator converts for you.
Measuring a running, walking or cycling route
A route is a chain of straight pieces. Measure the pieces, add them, and do not let the map flatter you.
A route distance is not one measurement but a sum: the path is broken into short straight segments, each segment is measured between its two endpoints, and the segments are added. That is what a GPS track does when you record a run, and it is what tracing a route on a map does when you click along it. The two methods differ only in how the endpoints are chosen. A GPS track chooses them for you, many per minute, and follows every bend. A traced route follows only the points you clicked, and every bend you skipped is a corner cut โ the traced distance comes out short, by exactly the ground the skipped bends covered. Click often on curves, and click at every turn: a route traced with too few points is a straight line pretending to be a road.
Elevation does not change the distance. A hilly 5K and a flat 5K cover the same horizontal distance, even though the hilly one climbs more. Route distances, race distances, and the distances on road signs are horizontal distances โ the distance on the map, not the distance along the slope. The slope distance is always slightly longer, but the difference on any ordinary road or trail gradient is small, and no race, map, or routing tool reports it. If a watch and a map disagree on a hilly route, the disagreement is almost always sampling โ the watch recording too few points on the bends, or the map tracing too few โ not the hill.
Out-and-back and loop checks. An out-and-back route is twice the one-way distance only if you return by the same path; a different return leg is a different route, and must be measured separately. A loop is measured once around, and the start and finish are the same point, which makes it easy to verify: measure the loop in both directions and the two figures should agree closely. When they do not, one of the two tracings cut a corner. The speed, distance, and time triangle in the companion guide is the other half of route planning: once the distance is honest, the time follows from the pace, and the pace follows from the time โ but only if the distance was measured first, in the open, rather than guessed from the map.
Frequently asked questions
Quick answers about distance and how this measurement is built.
What is the haversine formula?
It is the standard way to compute the great-circle distance between two latitude/longitude points on a sphere. It combines the latitude and longitude differences into a central angle, then multiplies by Earth’s radius (6,371 km) to get the surface distance.
How do I convert km to miles?
Multiply kilometers by 0.621371. This calculator does it for you: for example, 3,935.75 km ร 0.621371 = 2,445.56 miles.
Is this the same as driving distance?
No. This is the straight-line distance over Earth’s curved surface โ the shortest possible path. Driving distance follows roads and is always longer, sometimes much longer (NYC to LA is about 4,500 km by road versus 3,935.75 km as the crow flies).
What coordinate format do I enter?
Decimal degrees: latitude from โ90 (south) to 90 (north), longitude from โ180 (west) to 180 (east). New York is 40.7128, โ74.0060. To convert degrees-minutes-seconds, use degrees + minutes/60 + seconds/3600.
What is the farthest possible distance between two points?
Half of Earth’s circumference: ฯ ร 6,371 โ 20,015 km (12,437 miles). That is the distance between exact antipodal points, like (0, 0) and (0, 180).
Why do two sources give slightly different distances?
Three reasons: different reference points (city center vs. airport), different Earth models (sphere vs. the flattened WGS84 ellipsoid), and rounding of coordinates. Differences under about 0.5% on long routes are normal.
How do I find the distance between two points on a 2D plane?
Use the Pythagorean theorem: d = √((x₂−x₁)² + (y₂−y₁)²). Switch to the 2D plane tab above — for example, (0, 0) to (2, 3) gives √13 ≈ 3.6056.
How do I calculate 3D distance?
Extend the Pythagorean theorem to three dimensions: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). The 3D space tab computes it — (0, 0, 0) to (1, 1, 1) is √3 ≈ 1.7321.
What is a nautical mile and when is it used?
One nautical mile = 1.852 km = one minute of latitude. It is the standard unit in aviation and maritime navigation because it ties directly to the coordinate grid. Select it in the unit dropdown — NYC to LA is about 2,125 nautical miles.
What is the distance formula?
The distance formula gives the straight-line distance between two points on a plane: d = sqrt((x2 – x1)^2 + (y2 – y1)^2). It is the Pythagorean theorem applied to the horizontal and vertical differences between the points. In 3D it gains a third term, (z2 – z1)^2, inside the same square root. The 2D and 3D tabs above apply it for you.
What is the midpoint formula?
The midpoint formula averages the coordinates of the two endpoints: ((x1 + x2) / 2, (y1 + y2) / 2) in 2D, and ((x1 + x2) / 2, (y1 + y2) / 2, (z1 + z2) / 2) in 3D. It gives the point exactly halfway between the two points. Both plane modes above report the midpoint next to the distance – for example, (0, 0) and (2, 3) have midpoint (1, 1.5).
Can distance be negative?
No. Distance is a length, so it is always zero or positive: zero when the two points are identical, and positive otherwise. The differences between coordinates can be negative, but the distance formula squares them, so the sign disappears before the square root is taken. A direction or an angle can be negative; a distance cannot.
How do I calculate the great circle distance on a sphere?
Convert both points’ latitudes and longitudes to radians, then apply the haversine formula: a = sin^2(dphi/2) + cos(phi1) x cos(phi2) x sin^2(dlambda/2), and d = 2 x R x atan2(sqrt(a), sqrt(1 – a)), with R = 6,371 km. The Earth mode above runs exactly this – for New York to Los Angeles it returns 3,935.75 km. A full great circle is Earth’s circumference, about 40,030 km, so the longest possible great-circle trip is half of that, about 20,015 km.
How do I measure a route distance in miles or kilometres?
Trace the route on a map or record it with GPS, then read the total in the unit you want: 1 mile is 1.60934 kilometres, and 1 kilometre is 0.621371 miles. Trace with many points on curves, because every skipped bend shortens the result. For a route you will run or ride repeatedly, measure it once carefully and reuse the figure rather than re-tracing it each time.
Does altitude or elevation change the distance?
No, not in the distance that maps, races, and road signs report. Those distances are horizontal: the distance on the map. Travelling up a slope covers slightly more ground along the slope itself, but the difference on ordinary gradients is small and is not what any routing tool reports. A hill makes a route harder and slower; it does not make it longer on the map.
What is 3D distance, and when do I need it?
3D distance is the straight-line distance between two points in space, using all three coordinates: the square root of the sum of the squared differences in x, y, and z. On the surface of the Earth you almost never need it, because two surface points are handled by the great-circle distance. It matters when the points are genuinely in space โ aircraft positions, satellite geometry, or points at very different heights โ where the vertical separation is part of the distance itself.
Related calculators
More ways to measure, down to the last decimal.
Related guides
In-depth guides to straight lines, coordinates and great circles.
Ten city pairs, measured both ways.
New York to London, computed step by step.
Convert formats and dodge the classic mistakes.
Speed, Distance and Time โ the Triangle, with Worked Examples
The triangle, the three rearrangements, and worked examples.
Disclaimer
Results are estimates for information only โ they are not navigation advice. Distances use the haversine formula on a spherical Earth (radius 6,371 km) and represent the shortest surface path, not driving, flying, or shipping routes, which are always longer. Enter exact coordinates for the points you mean โ city-center defaults can differ from airports or addresses by tens of kilometers.