Latitude Longitude Distance Calculator
This latitude longitude distance calculator finds the great-circle distance between two GPS coordinates on Earth's surface using the Haversine formula. Enter latitude and longitude for both locations to get the distance in kilometers, miles, and nautical miles, along with the initial bearing and geographic midpoint.
Lat Long Distance Calculator
Calculate the shortest distance between two points on Earth's surface
Use N/S for latitude and E/W for longitude directions
Point 1
Point 2
Frequently Asked Questions
How do you calculate distance from latitude and longitude?
Use the Haversine formula, which accounts for Earth's curvature. Convert latitude and longitude from degrees to radians, compute the differences, apply the formula: a = sin²(dlat/2) + cos(lat1) * cos(lat2) * sin²(dlon/2), then d = 2R * arcsin(sqrt(a)), where R is Earth's radius (6,371 km or 3,959 miles). This gives the great-circle distance, the shortest path along the surface.
What is the Haversine formula?
The Haversine formula calculates the great-circle distance between two points on a sphere given their latitudes and longitudes. It uses the 'haversine' function: hav(theta) = sin²(theta/2). The formula is more numerically stable than the spherical law of cosines for small distances. It was historically important for navigation and remains the standard method for GPS distance calculations.
How accurate is GPS distance calculation?
The Haversine formula is accurate to within about 0.5% for most practical purposes, treating Earth as a perfect sphere. For higher accuracy (within 0.01%), Vincenty's formula uses an ellipsoidal Earth model. GPS coordinates themselves are typically accurate to 3-5 meters for consumer devices. For distances under 1 km, the flat-Earth approximation can also give reasonable results.
What is the difference between great-circle and straight-line distance?
Great-circle distance follows the shortest path along Earth's curved surface, like an airplane's flight path. Straight-line (Euclidean) distance cuts through the Earth in a direct line between two points. For short distances, the difference is negligible. For long distances, straight-line distance is always shorter but physically impossible to travel on Earth's surface. Great-circle distance is used for navigation and travel planning.
How do you convert degrees to distance?
One degree of latitude equals approximately 111.32 km (69.17 miles) everywhere on Earth. One degree of longitude varies by latitude: at the equator it is about 111.32 km, but it decreases to zero at the poles. The formula is: longitude distance = 111.32 * cos(latitude) km per degree. These are approximations; for precise calculations, use the Haversine formula with exact coordinates.
What is a nautical mile?
A nautical mile is a unit of distance used in maritime and air navigation, defined as exactly 1,852 meters (1.15078 statute miles or 6,076 feet). It was originally defined as one minute of arc of latitude along any meridian. This makes it convenient for navigation: one minute of latitude on a chart equals one nautical mile. Speed in nautical miles per hour is called a knot.
How far is one degree of latitude?
One degree of latitude is approximately 111.32 kilometers (69.17 miles) and remains nearly constant across the globe. This slight variation (from 110.57 km at the equator to 111.69 km at the poles) occurs because Earth is an oblate spheroid, slightly flattened at the poles. One minute of latitude is about 1.85 km (one nautical mile), and one second is about 30.87 meters.
What is the difference between the Haversine and Vincenty formulas?
The Haversine formula treats Earth as a perfect sphere (radius ≈ 6,371 km) and is accurate to ~0.5% (up to ~30 km error on long distances). The Vincenty formula models Earth as an oblate spheroid (WGS-84 ellipsoid) and is accurate to ~0.5 mm. For most practical purposes, Haversine is sufficient; Vincenty matters for surveying and geodesy.
How do I convert DMS coordinates to decimal degrees?
Decimal = Degrees + Minutes/60 + Seconds/3600. For example, 40°26'46"N = 40 + 26/60 + 46/3600 = 40.4461°. South latitudes and West longitudes are negative: 73°59'W = -73.9833°.
What is the bearing between two GPS points?
Bearing is the compass direction from one point to another, measured clockwise from north (0°–360°). Initial bearing from New York to London is approximately 51° (northeast). Bearing changes along the great-circle route.
How do I find the latitude and longitude of a location?
In Google Maps, right-click any location and the coordinates appear at the top of the menu. On iPhone, drop a pin and tap it to see coordinates. On Android, long-press a spot to drop a pin. GPS apps and devices display coordinates in their settings.
Related Calculators
- 3D Distance Calculator — Calculate distance between two points in 3D space
- 2D Distance Calculator — Euclidean distance between two points on a plane
- Scale Factor Calculator — Convert between map and real-world distances
What Is Latitude and Longitude?
Latitude and longitude form a geographic coordinate system that uniquely identifies every point on Earth. Latitude measures the north-south position, ranging from -90° (South Pole) to +90° (North Pole), with 0° at the equator. Longitudemeasures the east-west position, ranging from -180° to +180°, with 0° at the Prime Meridian (Greenwich, England). Together, a latitude-longitude pair pinpoints any location on the globe with sub-meter precision when enough decimal places are used. GPS devices, mapping applications, and surveying equipment all rely on this coordinate system.
The Haversine Formula
The Haversine formula calculates the great-circle distancebetween two points on a sphere, which is the shortest path along the surface. It uses the "haversine" function, hav(θ) = sin²(θ/2), and is defined as:
a = sin²(Δφ/2) + cos(φ₁) · cos(φ₂) · sin²(Δλ/2)
d = 2R · arctan2(√a, √(1-a))
where φ₁ and φ₂ are the latitudes in radians, Δφ is the latitude difference, Δλ is the longitude difference, and R is Earth's mean radius (6,371 km). The Haversine formula is numerically stable even for small distances, which makes it superior to the spherical law of cosines for GPS applications. It was historically important for maritime navigation and remains the standard method for computing distances between coordinates.
Haversine vs Vincenty: Accuracy Comparison
Two main formulas are used for geodesic distance calculations. The choice depends on the accuracy requirements of your application.
| Method | Earth Model | Accuracy | Speed | Best For |
|---|---|---|---|---|
| Haversine | Perfect sphere (R = 6,371 km) | ~0.5% (up to ~30 km error on long distances) | Very fast | Navigation, travel planning, general use |
| Vincenty | WGS-84 oblate spheroid | ~0.5 mm | Iterative (slower) | Surveying, geodesy, high-precision mapping |
For most practical purposes, the Haversine formula provides sufficient accuracy. The Vincenty formula is necessary only when sub-meter precision is required, such as in land surveying, geodetic reference networks, and precision mapping.
How to Calculate Distance Between Coordinates
Here is a worked example calculating the distance from New York City (40.7128°N, 74.0060°W) to London(51.5074°N, 0.1278°W).
- Convert to radians:φ₁ = 40.7128° × π/180 = 0.7106 rad, φ₂ = 51.5074° × π/180 = 0.8989 rad, Δφ = 0.1883 rad, Δλ = 1.2891 rad
- Compute a:a = sin²(0.0942) + cos(0.7106) · cos(0.8989) · sin²(0.6446) = 0.0089 + 0.7597 × 0.6266 × 0.3625 = 0.1812
- Compute c:c = 2 · arctan2(√0.1812, √0.8188) = 0.8742 rad
- Compute distance: d = 6,371 × 0.8742 = 5,567 km (3,459 miles)
The actual flight distance from New York to London is approximately 5,570 km, confirming the Haversine formula's accuracy for this route.
Coordinate Formats: Decimal vs DMS
Geographic coordinates can be expressed in two common formats: decimal degrees (DD) and degrees-minutes-seconds (DMS).
Conversion formula (DMS to Decimal):
Example: 40°26'46"N = 40 + 26/60 + 46/3600 = 40.4461°
South latitudes and West longitudes are negative: 73°59'0"W = -(73 + 59/60 + 0/3600) = -73.9833°
Most GPS devices and mapping APIs use decimal degrees. DMS notation is still common on paper maps and in traditional navigation. Our calculator accepts both formats, converting automatically for accurate distance computation.
Common City-Pair Distances
Reference distances between major world cities, calculated using the Haversine formula.
| From | To | Distance (km) | Distance (mi) | Initial Bearing |
|---|---|---|---|---|
| New York | London | 5,570 | 3,461 | 51° |
| Los Angeles | Tokyo | 8,815 | 5,478 | 305° |
| Sydney | Singapore | 6,288 | 3,907 | 335° |
| Dubai | Mumbai | 1,926 | 1,197 | 104° |
| São Paulo | Cape Town | 6,810 | 4,231 | 133° |
| Paris | Moscow | 2,486 | 1,544 | 61° |
| Beijing | Berlin | 7,354 | 4,569 | 329° |
| Cairo | Rome | 2,131 | 1,324 | 318° |
Related Tools
- 3D Distance Calculator — Calculate distance between two points in 3D space
- 2D Distance Calculator — Euclidean distance between two points on a plane
- Scale Factor Calculator — Convert between map and real-world distances