Latitude Longitude Distance Calculator - Great-circle distance from two GPS coordinates
Use this latitude longitude distance calculator to enter two GPS coordinates in decimal degrees and get the great-circle distance in km and miles, plus initial bearing and midpoint, using the haversine formula.
Latitude Longitude Distance Calculator
Results
What Is a Latitude Longitude Distance Calculator?
A latitude longitude distance calculator finds the great-circle distance between two points on Earth from their GPS coordinates in decimal degrees. Enter the latitude and longitude of a starting point and a destination point, and the page returns the shortest surface distance in kilometers and miles, the initial compass bearing, and the latitude and longitude of the half-way point along the great-circle path. It is the everyday answer to the question, "how far apart are these two places on the globe, and which way do I head from the first to the second?"
- • Travel planning between cities: Get the great-circle distance and the initial compass bearing from your home city to a destination city to sanity-check a flight path, a road trip detour, or a sea route.
- • Hiking, geocaching, and field GPS: Measure the distance from your current GPS reading to a trailhead, geocache, or survey marker without redrawing the route on a separate mapping app.
- • Logistics and delivery radius: Estimate delivery distances between warehouses, drop zones, and customer addresses from coordinates exported from a routing tool or spreadsheet.
- • GIS, mapping, and data prep: Compute pairwise distances from a list of decimal-degree coordinates before clustering, nearest-neighbor search, or a radius filter in a geographic dataset.
Because the page accepts coordinates in the same decimal-degree format used by GPS devices, mapping apps, and GIS exports, the workflow is the same whether the coordinates come from a phone, a spreadsheet, or a hand-typed value.
The output is the shortest path along the surface of a sphere, not the driving, walking, or flight distance, so treat the great-circle answer as the lower bound of the actual trip.
If you want to express the result in feet, nautical miles, or yards instead of km and miles, the Distance Converter page handles the unit math.
How the Latitude Longitude Distance Calculator Works
The page implements the haversine formula, the standard spherical-trigonometry method for great-circle distance. It converts each latitude and longitude from decimal degrees to radians, builds the angular differences, runs the haversine intermediate, and multiplies the central angle by the Earth's radius.
- φ1, φ2: Latitude of point 1 and point 2 in radians after converting from decimal degrees.
- λ1, λ2: Longitude of point 1 and point 2 in radians after converting from decimal degrees.
- Δφ, Δλ: Differences (φ2 − φ1) and (λ2 − λ1) in radians, used as the inputs to the half-angle sines.
- a: Haversine intermediate, sin²(Δφ/2) + cos(φ1) · cos(φ2) · sin²(Δλ/2). Always in [0, 1].
- c: Central angle in radians, c = 2 · atan2(√a, √(1 − a)).
- R: Mean Earth radius, R = 6371.0088 km (the value recommended by NOAA).
- d: Great-circle distance on the surface, d = R · c, in kilometers and converted to statute miles.
Worked example: New York City to London
Point 1: (40.7128, -74.0060). Point 2: (51.5074, -0.1278).
a ≈ 0.1914. c = 2 · atan2(√0.1914, √0.8086) ≈ 0.8741 rad. d = 6371.0088 · 0.8741 ≈ 5570.22 km.
Distance ≈ 5570.22 km (≈ 3461.18 mi). Initial bearing ≈ 51.21°.
An aircraft on this great circle leaves New York on a north-east heading of about 51° true and curves over Newfoundland before turning east toward London.
According to Movable Type Scripts, the haversine formula computes great-circle distance on a sphere using d = 2 · R · atan2(√a, √(1 − a)) with a = sin²(Δφ/2) + cos(φ1) · cos(φ2) · sin²(Δλ/2).
If you want to see why the spherical approach is preferred over a straight 3D subtraction through the Earth, the 3D Distance Calculator page runs the Cartesian (x, y, z) version of the same two points.
Key Concepts Behind the Haversine Formula
Four ideas explain why the formula uses radians, sines, and a fixed radius instead of a simpler subtraction.
Great-circle distance
The shortest path between two points on the surface of a sphere lies along a great circle, the largest circle through the sphere's center. That is what makes the central angle c the right input to multiply by R.
Decimal degrees and radians
GPS coordinates are written in decimal degrees, but every trig function in the haversine formula expects radians. The page multiplies each degree by π / 180 before calling sin or cos.
Mean Earth radius
The Earth is not a perfect sphere, so the page uses a mean radius R = 6371.0088 km, the value recommended by NOAA. Using the equatorial 6378.137 km instead shifts the result by a fraction of a percent.
Initial bearing and midpoint
The initial bearing is the compass heading you would set at point 1 to fly the great circle, in degrees from true north. The midpoint is the half-way point along that path.
Together these four ideas let the same formula return the distance, the bearing, and the midpoint from one set of inputs, which is why the page shows all five numbers from the same four coordinate fields.
The planar, flat-Earth version of the same two points uses just x and y instead of latitude and longitude, and the 2D Distance Calculator page shows the formula and midpoint side by side.
How to Use This Latitude Longitude Distance Calculator
Five short steps cover every common case, from a single named city pair to coordinates copied from a spreadsheet.
- 1 Enter latitude 1 and longitude 1: Type the first point in decimal degrees. The defaults are New York City (40.7128, -74.0060), so the page starts with a recognizable example.
- 2 Enter latitude 2 and longitude 2: Type the second point in decimal degrees. The defaults are London (51.5074, -0.1278), which gives the classic transatlantic distance.
- 3 Read the distance in km and miles: The primary outputs are the great-circle distance in kilometers and the same value in statute miles. Both update live as you edit any input field.
- 4 Read the bearing and the midpoint: Below the distance, the page shows the initial compass bearing from point 1 toward point 2 and the latitude and longitude of the half-way point along the great-circle path.
- 5 Convert units or rerun with new inputs: For feet, nautical miles, or yards, open the Distance Converter in a new tab. Click Reset on this page to return to the New York to London default.
Try (1.3521, 103.8198) as point 1 (Singapore) and (35.6762, 139.6503) as point 2 (Tokyo). The latitude longitude distance calculator returns about 5311.23 km (≈ 3300.25 mi), an initial bearing near 232.23°, and a midpoint near (19.3787, 111.8200), over the South China Sea.
If your coordinates arrive in degrees-minutes-seconds form like 40° 42' 46", the Coordinates Converter page converts them to decimal degrees before you paste them here.
Benefits of Using This Latitude Longitude Distance Calculator
These benefits matter most when you need a fast, trustworthy number from a coordinate pair without opening a full GIS package.
- • Skip the trig and the arithmetic: Manual haversine problems are easy to get wrong on the radians conversion or the half-angle sines. The calculator handles the trig so you can focus on the inputs and the meaning of the answer.
- • Get km and miles in one pass: Most searches mix metric and US customary units. The page returns both from the same four inputs, using the exact 1 mi = 1.609344 km factor.
- • See the bearing and midpoint alongside the distance: A great-circle answer alone is not enough for trip planning. The page adds the initial compass heading and the half-way point so the distance is immediately useful.
- • Validate coordinates before they reach another tool: Latitude outside [-90, 90] or longitude outside [-180, 180] is rejected with a clear error before any trig runs, so the page doubles as a coordinate validator.
- • Use the same decimal-degree format as GPS devices and GIS exports: Paste a value straight from a phone screenshot, a Google Maps pin, or a CSV export and the page accepts it without re-formatting first.
The page is most useful as a quick check, not as a replacement for a routing engine. Use it to validate a coordinate, to estimate a flight or sea distance, or to pre-compute a radius before the points reach a longer script.
For the same haversine calculation but with nautical miles and a waypoint-style result layout, the Great Circle Calculator page sits next to this one in the math category.
Factors That Affect the Latitude Longitude Distance Result
The haversine formula is the same in every case, but a few factors change how the result should be read or what input format you should use.
Input format: decimal degrees vs DMS
Decimal degrees (40.7128) are the form expected here. A value written as 40° 42' 46" needs to be converted to 40 + 42/60 + 46/3600 ≈ 40.7128 first; pasting it in raw gives a coordinate off by a factor of 60 or 3600 and a wildly wrong distance.
Spherical-Earth approximation
The page treats the Earth as a sphere with mean radius 6371.0088 km. The real Earth is an oblate spheroid, so the result is accurate to within about 0.3% for most pairs; for sub-meter work, use an ellipsoidal model such as Vincenty's formulae instead.
Order of the two points
Swapping point 1 and point 2 leaves the distance unchanged, but the initial bearing flips by 180° and the midpoint stays the same. The page always reports the bearing from point 1 toward point 2, so order still matters for navigation.
Antimeridian crossing and antipodes
Two points close to the antimeridian (longitude near ±180) and two antipodal points need extra care. The page reports the short-way great circle and a half-circumference distance for antipodes, but treat both as edge cases rather than routine calculations.
- • The page is the spherical case only. For sub-percent accuracy on a flat-projection map, switch to an ellipsoidal method (Vincenty) or to a planar distance on a local projection.
- • The great-circle answer is the shortest surface distance, not the road, rail, or flight distance. Real travel paths follow roads, airways, or shipping lanes and are almost always longer.
- • The initial bearing is the heading at point 1 only. The compass heading changes continuously along the great circle, so the bearing at the midpoint is different from the initial value.
According to NOAA National Hurricane Center, the mean radius of the Earth used for spherical distance calculations is 6371.0088 km.
According to NIST, 1 international mile equals exactly 1.609344 kilometers, the value used to convert the great-circle result between metric and US customary units.
When the two points straddle the antimeridian and a flat-projection distance is more useful than a global great circle, convert the pair to UTM first and run the distance there with the Lat Long to Utm Calculator page.
Frequently Asked Questions
Q: What is the formula for distance between two latitude and longitude points?
A: The haversine formula is the standard. Compute a = sin²(Δφ/2) + cos(φ1) · cos(φ2) · sin²(Δλ/2), then the central angle c = 2 · atan2(√a, √(1 − a)), and finally the surface distance d = R · c. With R = 6371.0088 km, the result is the great-circle distance in kilometers.
Q: How accurate is the haversine formula for distance on Earth?
A: For most pairs of points the haversine answer is within about 0.3% of the ellipsoidal value because the Earth is nearly spherical. The error grows near the poles. For survey-grade work, use Vincenty's formulae instead.
Q: What is the difference between the haversine formula and the spherical law of cosines?
A: Both formulas give the same great-circle distance on a perfect sphere. The law of cosines uses d = R · acos(sin(φ1) · sin(φ2) + cos(φ1) · cos(φ2) · cos(Δλ)), which loses precision for very small separations. The haversine form stays numerically stable for those cases.
Q: How do I find the distance between two GPS coordinates in miles or kilometers?
A: Enter the first latitude and longitude in decimal degrees, then the second latitude and longitude. The page returns the great-circle distance in both kilometers and statute miles at the same time, using the exact 1 mile = 1.609344 km factor.
Q: Why is the Earth modeled as a sphere when calculating coordinate distance?
A: Treating the Earth as a sphere makes the math a single closed-form formula with a single radius R. The mean radius 6371.0088 km recommended by NOAA gives answers within a few tenths of a percent of an ellipsoidal calculation for almost every pair of points.
Q: What does the initial bearing tell me about the path between two coordinates?
A: The initial bearing is the compass heading you would set at point 1 to follow the great-circle path toward point 2, measured in degrees from true north (0° = north, 90° = east, 180° = south, 270° = west). It changes continuously along the path.