User Rating 0.0 ★★★★★
Total Usage 0 times
Point A
Point B
Is this tool helpful?

Your feedback helps us improve.

★ ★ ★ ★ ★

About

Miscalculating the distance between two coordinate points leads to cumulative positioning errors in surveying, navigation route planning, and geospatial data analysis. A naive flat-Earth Euclidean approximation on geographic coordinates introduces errors exceeding 20% at high latitudes or over distances above 100km. This tool implements both the Haversine formula (spherical model, R = 6371.0088km) and Vincenty's inverse formulae (WGS-84 ellipsoid, a = 6378137m, f = 1/298.257223563) to compute geodesic distances with sub-meter precision. For Cartesian coordinate systems it computes Euclidean and Manhattan distances in 2D and 3D space.

The tool also derives initial and final bearings, geographic midpoint coordinates, and supports output in 6 distance units. Results approximate real-world distances assuming no terrain elevation changes. For geographic mode, accuracy degrades for nearly antipodal points where Vincenty iteration may not converge. In such edge cases the calculator falls back to the Haversine result automatically.

coordinate distance haversine calculator vincenty formula GPS distance euclidean distance geodesic distance bearing calculator midpoint calculator

Formulas

The Haversine formula computes the great-circle distance between two points on a sphere from their latitudes and longitudes:

a = sin2(Δφ2) + cos(φ1) ⋅ cos(φ2) ⋅ sin2(Δλ2)
d = 2 ⋅ R ⋅ atan2(√a, √1−a)

Where φ1, φ2 are latitudes in radians, Δφ = φ2 − φ1, Δλ = λ2 − λ1, and R = 6371.0088 km (mean Earth radius).

The initial bearing (forward azimuth) from point 1 to point 2:

θ = atan2(sin(Δλ) ⋅ cos(φ2), cos(φ1) ⋅ sin(φ2) − sin(φ1) ⋅ cos(φ2) ⋅ cos(Δλ))

For Cartesian coordinates, the Euclidean distance in 2D:

d = √(x2 − x1)2 + (y2 − y1)2

And in 3D:

d = √(x2 − x1)2 + (y2 − y1)2 + (z2 − z1)2

The Manhattan distance (L1 norm) sums absolute component differences: dM = |x2 − x1| + |y2 − y1| + |z2 − z1|.

Reference Data

Constant / ParameterSymbolValueContext
Mean Earth Radius (IUGG)R6371.0088 kmHaversine spherical model
WGS-84 Semi-major Axisa6378137.0 mVincenty ellipsoid
WGS-84 Flatteningf1/298.257223563Vincenty ellipsoid
WGS-84 Semi-minor Axisb6356752.3142 mDerived: a×(1−f)
Kilometerkm1.0Base unit (geographic)
Mile (statute)mi0.621371 mi/kmUS/UK standard
Nautical Milenmi0.539957 nmi/kmAviation / Maritime
Meterm1000 m/kmSI base
Footft3280.84 ft/kmUS Customary
Yardyd1093.61 yd/kmUS Customary
Latitude Rangeφ[−90, 90]°Geographic constraint
Longitude Rangeλ[−180, 180]°Geographic constraint
Vincenty Max Iterations - 200Convergence limit
Vincenty Toleranceε1×10−12Radian precision
Haversine Error (100 km) - ≤ 0.3%Spherical approximation
Haversine Error (1000 km) - ≤ 0.5%Spherical approximation
Vincenty Accuracy - ≤ 0.5mmEllipsoidal model
Equator Circumference - 40075.017 kmMaximum great-circle
Polar Circumference - 40007.863 kmMeridional great-circle
1° Latitude at Equator - 110.574 kmLinear approximation
1° Longitude at Equator - 111.320 kmDecreases with cos(φ)

Frequently Asked Questions

The Haversine formula models the Earth as a perfect sphere with radius R = 6371.0088 km. Because the Earth is an oblate spheroid (equatorial radius exceeds polar radius by about 21 km), the Haversine error grows with distance and latitude. For distances under 50 km, the difference is typically under 0.1%. For transcontinental distances (above 5000 km) near the poles, errors can reach 0.3% to 0.5% (several kilometers). Vincenty's formulae on the WGS-84 ellipsoid achieve sub-millimeter theoretical accuracy.
Vincenty's inverse formula uses an iterative approach that can fail to converge for nearly antipodal points (points separated by close to 180°). This calculator sets a maximum of 200 iterations with a tolerance of 1×10−12 radians. If convergence fails, the tool automatically falls back to the Haversine result and flags this in the output. For most practical navigation and surveying tasks, truly antipodal inputs are rare.
One degree of longitude at the equator spans approximately 111.320 km, but this decreases proportionally to cos(φ). At latitude 45°, one degree of longitude is about 78.7 km. At 60°, it drops to roughly 55.7 km. At the poles (90°), it converges to zero. One degree of latitude remains relatively constant at approximately 110.574 km regardless of position.
The tool accepts decimal degrees directly. To convert DMS to decimal degrees, use the formula: decimal = degrees + minutes60 + seconds3600. For southern latitudes and western longitudes, apply a negative sign. For example, 40°26′46″N is 40.4461°.
The initial bearing (forward azimuth) is the compass direction you would face when departing from Point 1 toward Point 2 along the shortest path (great circle). It is measured clockwise from true north (0°) through east (90°), south (180°), and west (270°). The final bearing is the direction of arrival at Point 2. On a great-circle path, the bearing changes continuously, so initial and final bearings differ unless traveling along a meridian or the equator.
Euclidean distance in raw lat/lon values is geometrically meaningless because one degree of longitude varies with latitude. However, for very short distances (under approximately 1 km) in projected coordinates (like UTM or local grid systems), Euclidean distance is both accurate and computationally cheaper. The Cartesian mode in this tool is designed for such projected or abstract coordinate systems, not for raw geographic degrees.