As the Crow Flies Distance Calculator: How Great-Circle Distance Is Actually Calculated
As the crow flies distance calculator math: how the haversine formula computes great-circle distance between two coordinates on Earth, worked through step by step with real city pairs and its accuracy limits.
Two straight lines connect New York and London: the one an as the crow flies distance calculator draws, about 5,570 kilometers over the curved surface of the Earth, and the one nobody can actually fly, straight through the planet's crust. As the crow flies distance is the first of those, the shortest path along the surface, and it is one of the oldest and most misunderstood ideas in distance measurement. This piece works through exactly how it is calculated, with the arithmetic shown at every step, why it is not the same number your GPS app gives you for a drive, and where the formula itself starts to lose accuracy.
The short version: as the crow flies distance comes from the haversine formula, a piece of spherical trigonometry that treats the Earth as a sphere and works out the shortest arc between two latitude and longitude points along its surface. Everything below unpacks that sentence, term by term, with real coordinates.
Where "as the crow flies" comes from
Crows do not actually fly in straight lines, corvids are known for indirect flight paths around obstacles like anything else, so the phrase is a figure of speech, not an ornithological fact. It shows up in English by at least the early 1800s as a way to describe a direct line between two places, in contrast to the winding distance of a road or river route between the same two points. Sailors and surveyors had already been solving the more technical version of the same problem for centuries, working out the shortest path between two points on a globe for navigation, long before the crow idiom was recorded in print.
That older technical problem is what this post is really about. A ship's navigator plotting a course between two ports needed the shortest arc across a curved ocean surface, not a straight line drawn on a flat chart, because a straight line on a flat chart is not actually the shortest real-world path once the Earth's curvature is accounted for. The mathematics that solves this is called great-circle distance, and "as the crow flies" is simply the everyday name for the same result.
The haversine formula, step by step
A great circle is any circle drawn on a sphere's surface whose center is also the sphere's center, the largest possible circle you can draw on a ball. The equator is one example; every line of longitude, paired with its opposite line on the far side of the planet, is another. The shortest path between any two points on a sphere always lies along the great circle that passes through both of them, which is the geometric fact the whole formula is built on.
The haversine formula finds the length of that arc from two latitude/longitude pairs. Written out, with φ (phi) for latitude and λ (lambda) for longitude, both in radians:
a = sin²(Δφ/2) + cos(φ1) · cos(φ2) · sin²(Δλ/2)
c = 2 · asin(√a)
d = r · c
Δφ is the difference in latitude between the two points, and Δλ is the difference in longitude. The formula works in three stages. First, a combines the latitude gap and the longitude gap, scaled by how far the two points sit from the equator, since a degree of longitude covers less real ground near the poles than it does at the equator. Second, c turns that combined value into a central angle, measured in radians, between the two points as seen from the center of the Earth. Third, multiplying that angle by the Earth's radius, r, converts an angle into an actual distance, since arc length equals radius times angle in radians. A mean radius of 6,371 kilometers is the standard constant used here.
The name "haversine" comes from "half a versed sine," an old trigonometric function, haversine(θ) = sin²(θ/2), that mostly fell out of general use once calculators made it unnecessary, but survives inside this one formula because of a real numerical advantage. An older, more direct approach (the spherical law of cosines) technically computes the same central angle, but it loses precision for points that are close together, where the cosine of a tiny angle rounds to almost exactly 1 in floating-point arithmetic and washes out the small differences that matter. The haversine version stays numerically stable at any distance, from two points a few meters apart to two points on opposite sides of the planet, which is the whole reason it is the version everyone actually implements.
Worked example: New York to London
New York City sits at approximately 40.7128°N, 74.0060°W. London sits at approximately 51.5074°N, 0.1278°W. Converting to the sign convention the formula needs, west longitudes are negative, so New York is (40.7128, -74.0060) and London is (51.5074, -0.1278).
The latitude difference, Δφ, is 51.5074 minus 40.7128, which is 10.7946 degrees. The longitude difference, Δλ, is -0.1278 minus -74.0060, which is 73.8782 degrees. Converted to radians (multiplying by π/180), Δφ is about 0.18840 radians and Δλ is about 1.28942 radians.
Plugging into the formula: sin²(Δφ/2) works out to about 0.008848, and cos(40.7128°) · cos(51.5074°) · sin²(Δλ/2) works out to about 0.75799 × 0.62241 × 0.36116, which is about 0.17039. Adding those two pieces gives a of about 0.17924. Taking the square root and applying asin doubles back into an angle, c, of about 0.87431 radians. Multiplying by the Earth's radius, 6,371 kilometers, gives a distance of about 5,570 kilometers, or 3,461 miles after converting with the standard 0.621371 kilometers-to-miles factor.
That figure matches the commonly published great-circle distance between the two cities closely; small differences between sources usually come down to whether the calculation used airport coordinates, city-center coordinates, or a slightly different Earth radius, not a different formula.
Three more worked examples, short and long
A single example never proves a formula works generally, so here are three more, chosen to cover a short regional hop and a longer cross-country pair.
Boston to New York City is a short regional distance: Boston at (42.3601, -71.0589) to New York at (40.7128, -74.0060) comes out to about 306 kilometers, or 190 miles, as the crow flies. San Francisco to Los Angeles, (37.7749, -122.4194) to (34.0522, -118.2437), comes out to about 559 kilometers, or 347 miles. Houston to Dallas, (29.7604, -95.3698) to (32.7767, -96.7970), comes out to about 362 kilometers, or 225 miles, noticeably farther than the roughly 235 kilometers (146 miles) from Houston to the closer city of Austin.
Every one of these is meaningfully shorter than the equivalent road trip, because a great circle ignores the highway network entirely. That gap is small over a short, direct hop like Houston to Austin and grows on routes where the road network has to work around terrain, coastline, or simply does not run in a straight line between the two points.
Great-circle distances at a glance
A short reference table, all computed with the same haversine formula above, useful for sanity-checking any calculator against a known figure.
| City pair | Great-circle distance (km) | Great-circle distance (mi) |
|---|---|---|
| New York to London | 5,570 | 3,461 |
| San Francisco to Los Angeles | 559 | 347 |
| Boston to New York | 306 | 190 |
| Houston to Dallas | 362 | 225 |
| Houston to Austin | 235 | 146 |
| Portland to Seattle | 234 | 145 |
| Austin to San Antonio | 118 | 74 |
Every row in that table is the straight-line figure, not a driving distance. The distance calculator reproduces any of these directly: enter the two latitude/longitude pairs above on its Lat/Long tab, or click both cities on its Map tab, and it returns the same number.
More city pairs people look up
The same formula reproduces the pairs readers search for most often. Each figure below is the straight-line distance, so every road, rail or flight route between the same cities is longer.
| City pair | Great-circle distance (km) | Great-circle distance (mi) |
|---|---|---|
| Detroit to Chicago | 381 | 237 |
| LA to Las Vegas | 368 | 228 |
| Pittsburgh to New York | 507 | 315 |
| Pittsburgh to Philadelphia | 414 | 257 |
| San Francisco to San Diego | 738 | 458 |
| Barcelona to Paris | 831 | 516 |
| Boston to Philly | 436 | 271 |
| Philadelphia to Washington DC | 198 | 123 |
| Atlanta to DC | 873 | 542 |
| Boston to Washington DC | 634 | 394 |
| Boston to Montreal | 403 | 250 |
| Baltimore to Philadelphia | 144 | 90 |
| San Jose to Los Angeles | 492 | 305 |
| Denver to Los Angeles | 1,336 | 830 |
| SFO to ORD | 2,964 | 1,842 |
As a rule of thumb, road distances run roughly 10 to 30 percent above the straight-line figure, depending on terrain and how the road network is laid out. The airport pair, SFO to ORD, uses the airports' own coordinates, so it differs slightly from a city-centre to city-centre figure for San Francisco and Chicago. Use the table as a sanity check on any distance tool: a driving or flying distance that comes out shorter than the straight-line figure for the same two points means something is wrong with the inputs.
All figures in these two tables use a mean Earth radius of 6,371 kilometers and convert to miles by dividing by 1.609344. A different radius, such as the equatorial 6,378 kilometers, shifts every figure by about 0.1 percent, which is why two calculators can disagree in the last digit without either one being wrong. Rounding to the nearest kilometer or mile, as the tables do, hides that difference completely.
Why the formula assumes a perfect sphere
The Earth is not a perfect sphere. It is an oblate spheroid, very slightly flattened at the poles and bulging at the equator, a shape produced by its own rotation over geological time. The equatorial radius is about 6,378.137 kilometers and the polar radius is about 6,356.752 kilometers under the WGS84 reference standard used by GPS, a difference of about 21 kilometers, small compared to the planet's size but not zero.
The haversine formula sidesteps that detail entirely by using a single mean radius, 6,371 kilometers, splitting the difference. For most purposes this is close enough that the resulting error is not worth worrying about, typically within a small fraction of a percent of a more precise ellipsoidal calculation. Formulas that do model the flattening, most notably Vincenty's formula and the newer Karney algorithm, solve the same shortest-path problem on an ellipsoid instead of a sphere, at the cost of a noticeably more involved calculation. Surveying, geodesy and aviation-grade navigation reach for one of those instead of the haversine formula when the extra precision matters; everyday distance lookups, mapping software and this calculator do not need it.
Real-world uses of an as the crow flies distance calculator: flights, ships and radius search
Long-haul flight planning starts from a great-circle path, which is why a flight from New York to Tokyo, viewed on a globe, curves up over the North Pole region rather than heading straight west, that curved-looking path is in fact the shortest possible route between the two airports; it only looks curved because the map projection distorts it. Shipping routes work the same way for open-ocean legs, adjusted afterward for currents, weather routing and traffic separation schemes near busy coastlines.
A more everyday use sits behind a feature most people have used without naming it: "restaurants within 5 miles" or "jobs within 25 kilometers" on almost any search or maps app. That radius search is essentially an as the crow flies distance calculator, a haversine calculation running in the background, checking whether each candidate location's great-circle distance from you falls inside the radius you asked for. It is fast precisely because it does not need to calculate an actual driving route for every candidate first, it only needs the straight-line distance to filter the list down before anything more expensive happens.
Edge cases worth knowing
Two points at the exact same coordinates correctly return a distance of zero, since Δφ and Δλ are both zero and the whole formula collapses to zero without any special-case handling required.
Antipodal points, meaning two points on exactly opposite sides of the planet, such that a straight line between them passes through the Earth's center, produce the maximum possible great-circle distance: about 20,015 kilometers, or roughly 12,437 miles, exactly half of Earth's circumference. Madrid and a point in the ocean near New Zealand sit close to being antipodes of each other, and a haversine calculation between two such near-opposite points comes out close to that ceiling. No two points on Earth can be farther apart than that figure, no matter which formula computes the distance.
Crossing the 180th meridian, the antimeridian near the international date line, is handled correctly by the formula as written, since it only ever works with the difference between two longitude values, not their absolute position, so a pair of points on either side of that line still produces the correct short-way-around distance rather than an inflated one that goes the long way around the globe.
Common mistakes when computing this by hand
Forgetting to convert degrees to radians before applying the trigonometric functions is the single most common bug, since every one of sin, cos and asin in a programming language's math library expects radians, not degrees, and a result computed with raw degree values comes out wrong by a large, confusing factor rather than failing loudly.
Swapping latitude and longitude is the second most common mistake, and one of the quieter ones, because both are ordinary numbers within overlapping ranges near the equator and prime meridian, so a swapped pair does not always produce an obviously broken result, it just quietly describes the wrong two points.
Using the wrong Earth radius, or mixing a radius given in miles with coordinates expected to produce kilometers, is the third. Pick one radius, in one unit, and convert the final answer afterward if the other unit is needed, rather than trying to swap constants mid-calculation.
Working all of this out by hand is a useful exercise exactly once, to confirm the formula makes sense; after that, the distance calculator's Lat/Long and Map tabs run the identical formula instantly, in either kilometers or miles, without any risk of a degrees/radians slip. For the flat-plane version of distance, the kind that applies to coordinate geometry rather than real-world coordinates, the same page's 2D and 3D tabs cover that separately, and the Pythagorean theorem calculator and slope calculator cover the closely related geometry of a straight line between two plotted points.