Great Circle Calculator - Haversine Distance and Bearing Solver
Use this great circle calculator to find the surface distance, initial bearing, and midpoint between two lat/long points in km, miles, and nautical miles.
Great Circle Calculator
Results
What Is a Great Circle Calculator?
A great circle calculator finds the shortest surface distance between two points on a sphere, the initial compass bearing to follow that path, and the midpoint of the arc. It treats the Earth as a sphere, takes two latitude/longitude pairs, and uses the haversine formula to turn the angular separation into a real distance.
- • Long-haul flight and shipping planning: Estimate the great circle distance between two cities to compare with the route actually flown, factor in fuel, or sanity-check an airline's claim.
- • Marine and sailing navigation: Compute the orthodrome (the shortest path on the ocean) between two ports in nautical miles, with the initial bearing to set on departure.
- • Geography and homework problems: Confirm a textbook answer about the distance between two capitals, two landmarks, or two latitude/longitude pairs.
- • GPS and mapping tools: Build or check a small GPS script that needs a fast, accurate spherical distance without a full library.
A great circle is the largest circle on a sphere and the geodesic between any two points, which is why the great circle is the path an airline plotter draws on a long-haul map.
If the surface distance comes out in kilometers and you need statute miles, nautical miles, or feet, the Distance Converter page changes the unit of the result without recomputing the haversine.
How the Great Circle Calculator Works
The page implements the haversine formula in JavaScript. It takes the two latitude/longitude pairs, converts them to radians, builds the difference terms, and applies the formula to get the angular separation c. Multiplying c by the mean Earth radius converts the angle into a surface arc length in kilometers.
- lat1, lon1: Latitude and longitude of the first point, in decimal degrees.
- lat2, lon2: Latitude and longitude of the second point, in decimal degrees.
- φ1, φ2, Δφ, Δλ: Latitudes and the latitude/longitude differences, in radians, used inside the trig functions.
- R = 6371.0088 km: Mean Earth radius used to convert the angular distance c into a surface distance d.
All four coordinates go in as decimal degrees, but the trig functions inside the haversine formula work in radians. The page multiplies each input by π/180 before any sine or cosine runs, and converts the final bearing back to degrees.
Worked example: New York to London
Point 1: (40.7128, -74.0060). Point 2: (51.5074, -0.1278).
In radians: φ1 = 0.7106, φ2 = 0.8990, Δφ = 0.1884, Δλ = 1.2894. a = 0.00885 + 0.17039 = 0.17924. c = 2·atan2(0.4234, 0.9041) = 0.8743 rad. d = 6371.0088 × 0.8743 = 5570 km.
Distance ≈ 5570 km, initial bearing ≈ 51.2°, midpoint ≈ (52.37°, -41.29°).
The great circle from New York to London is about 5570 km, shorter than a flat Earth approximation. The initial bearing of about 51° (northeast) is the compass heading on departure, and it changes along the path because the great circle curves relative to the meridians.
According to Movable Type Scripts (Chris Veness), the great circle distance between two latitude/longitude points is computed with the haversine formula d = 2·R·atan2(√a, √(1−a)) where a = sin²(Δφ/2) + cos(φ1)·cos(φ2)·sin²(Δλ/2) and all angles are in radians.
If your coordinates are in degrees-minutes-seconds or in UTM and not in the decimal degrees the haversine formula expects, the Coordinates Converter page changes the format of the input before you type the numbers into this one.
Key Concepts Behind the Great Circle Calculation
Four ideas explain what a great circle really is and how the bearing and midpoint follow from the same inputs.
Great circle
The largest circle on a sphere, whose plane passes through the center. The equator and every meridian are great circles; the only other is the one defined by the two points you started with.
Haversine formula
A numerically stable form of the spherical law of cosines for the angular distance c between two points. It avoids the floating-point loss the plain law of cosines suffers when the points are very close, and works for short hops and half the planet with the same code.
Mean Earth radius
The Earth is not a perfect sphere; the equatorial radius is about 6378.137 km and the polar radius is about 6356.752 km. The mean radius of 6371.0088 km is the value the haversine formula uses when the model is a sphere, the same constant used by most GPS and chart tools.
Initial bearing
The compass heading to steer when you leave point 1 toward point 2. On a great circle, that bearing changes continuously because the path curves relative to the meridians, which is why a New York to London flight starts northeast and arrives southeast.
The page only uses spherical geometry, so it ignores the small flattening of the Earth. The error is well under 0.5%, the same approximation used by most airline and nautical calculators.
The angular distance c in radians is the same as the central angle between the two points, and the Central Angle Calculator page turns that angle into a planar fraction of a circle, sector area, and chord length.
How to Use This Great Circle Calculator
Five short steps take you from two coordinates to a distance, bearing, and midpoint.
- 1 Look up the latitude and longitude of point 1: Use decimal degrees, positive for north and east, negative for south and west. New York is (40.7128, -74.0060); London is (51.5074, -0.1278).
- 2 Look up the latitude and longitude of point 2: Same format. The defaults are New York and London so the example starts as a familiar transatlantic great circle.
- 3 Read the great circle distance: The primary output is the surface arc length in kilometers, updated as you type. Statute miles and nautical miles appear below.
- 4 Read the initial bearing and midpoint: The initial bearing is in degrees from true north; the midpoint is a latitude and longitude. Use the bearing as the heading to set on departure; use the midpoint to plot a waypoint.
- 5 Check the result against a known example: Run the New York to London example first. The page should return about 5570 km, a bearing near 51°, and a midpoint near (52.37°, -41.29°).
For a flight from Sydney (-33.8688, 151.2093) to Tokyo (35.6762, 139.6503), the calculator returns a great circle distance of about 7826 km, an initial bearing near 350°, and a midpoint near (0.91°, 145.49°).
The haversine formula runs on radians, so the Angle Converter page is the right place to confirm the degree-to-radian step that happens inside the calculation when you want to follow the math by hand.
Benefits of Using This Great Circle Calculator
These benefits matter most when planning a route, checking a claim, or running a script that needs a known-correct spherical distance.
- • Use the shortest path on a sphere: The haversine formula gives the orthodrome between two coordinates, the geodesic on a sphere. That is shorter than any straight line on a flat projection and matches what airline and marine charts plot as a great circle route.
- • Get the bearing and midpoint for free: From the same four inputs, the page returns the initial bearing, the midpoint, and the surface distance, enough information to plan a route without a separate navigation tool.
- • Return all three common distance units: The same calculation gives you kilometers, statute miles, and nautical miles in one pass, useful for both land travel and marine or air navigation.
- • Stay numerically stable at short and long distances: The haversine form avoids the floating-point loss that the plain spherical law of cosines suffers when the points are very close. The same code path works for a 100-meter hop and a 20015-km antipodal route.
- • Plug straight into a small script: The pure calculation function in the page is self-contained JavaScript, so you can paste it into a Node script or a small web app to compute spherical distances.
The page is most useful as a check, not as a replacement for understanding the formula. Use it to confirm a homework answer, sanity-check an airline's trip length claim, or pre-validate a coordinate pair.
If your two points have a real altitude or a z-coordinate and you want the straight-line distance through space rather than the surface arc, the 3D Distance Calculator page runs the same Pythagorean formula on a 3D vector.
Factors That Affect the Great Circle Result
The haversine formula is the same in every case, but a few factors change how the result should be read.
Choice of Earth radius
The page uses the mean Earth radius of 6371.0088 km. Tools using the WGS84 equatorial radius (6378.137 km) report about 0.1% to 0.3% longer; the polar radius returns a slightly shorter distance.
Spherical vs ellipsoidal model
The haversine formula treats the Earth as a sphere. Vincenty's formula accounts for the slight flattening and gives a result accurate to within a meter. The error from using the sphere is under 0.5%.
Direction of the bearing
The initial bearing formula is not symmetric. The bearing from A to B differs from B to A by 180° plus a small extra. If you swap the two points, the distance is unchanged but the bearing flips by close to 180°.
Crossing the 180° meridian
Points close to the antimeridian (179° E and 179° W) can look like a 358° longitude difference on a flat map. The haversine formula uses the longitude difference as a signed value before the trig functions, so it returns a short arc, not the long way around the planet.
Numerical precision of the coordinates
The result is sensitive to the precision of the inputs. A coordinate rounded to one decimal place is about 11 km of arc on the equator, so a four-decimal input is the right precision for most navigation use.
- • The page is the spherical case only. Vincenty's formula on the WGS84 ellipsoid gives a result correct to about a meter, but is more code to maintain and falls apart for nearly antipodal points.
- • The bearing shown is the initial heading. On a great circle, the heading changes continuously as the path curves relative to the meridians, which is why long-haul flights update the heading at every waypoint.
- • The result is the surface distance, not the chord through the Earth and not the route distance along a road or a shipping lane. For road distance you need a routing engine with a road graph.
According to NASA National Space Science Data Center, the mean radius of the Earth is 6371.0088 km, which is the standard value used to convert a great-circle angular distance in radians into a surface arc length in kilometers.
When the path between the two points follows a known curve other than a great circle, the Arc Length Calculator page integrates the distance along that curve instead of returning the chord or the surface arc.
Frequently Asked Questions
Q: What is the great circle distance between two points?
A: The great circle distance is the length of the shortest path between two points on the surface of a sphere, measured along the arc of the great circle that contains both points. On the Earth, the great circle is the path an airline plotter draws on a long-haul map and the orthodrome a navigator follows at sea.
Q: How is the great circle distance calculated on a sphere?
A: The haversine formula computes the angular separation c in radians from the two latitudes and longitudes, then multiplies c by the mean Earth radius R. The formula is a = sin²(Δφ/2) + cos(φ1)·cos(φ2)·sin²(Δλ/2), c = 2·atan2(√a, √(1−a)), and d = R·c, with all angles in radians.
Q: What is the difference between great circle and rhumb line distance?
A: A great circle is the shortest path between two points on a sphere, and the compass bearing changes along the way. A rhumb line is a path of constant compass bearing, which is useful for following a single heading but is generally longer than the great circle except when the two points share a meridian or sit on the equator.
Q: What is the haversine formula and why is it used?
A: The haversine formula is a numerically stable form of the spherical law of cosines. It avoids the small floating-point loss the plain law of cosines suffers when the two points are very close, and it works for short hops and for half the planet with the same code path, which is why most consumer and aviation tools use it.
Q: How accurate is the great circle distance calculator?
A: For a spherical Earth, the result is exact to the displayed two-decimal precision in kilometers, miles, and nautical miles. Compared with the WGS84 ellipsoid, the spherical model introduces an error of under 0.5% on routes of any length, which is the same approximation used by most airline and marine tools.
Q: What Earth radius does the great circle calculator use?
A: The page uses the mean Earth radius of 6371.0088 km from the NASA factsheet. That value is the standard one for converting a great-circle angular distance in radians into a surface arc length in kilometers, and it is the same constant used by most consumer GPS and marine chart tools.