Place names become coordinates before distance can be calculated
A city name is not a numeric location. The lookup step matches the entered text to a locality record containing latitude and longitude, and the selected match must be shown back to the user. Springfield, San José, and similarly named places can refer to multiple jurisdictions, so country or region context matters. The distance step begins only after both endpoints are resolved to explicit coordinates.
Latitude and longitude describe angles on a reference surface; they are not flat x and y lengths. The calculator converts degrees to radians, applies the haversine relationship to obtain the central angle between the two points, and multiplies that angle by its stated mean Earth radius. For a local Cartesian drawing rather than cities, the coordinate distance calculator is the appropriate model.
The haversine calculation follows the shorter spherical arc
- Convert four angles to radians
Both latitudes and both longitudes are converted from degrees. Their differences are calculated in radians so trigonometric functions receive the expected unit.
- Find a dimensionless central angle
The haversine expression combines the latitude change and longitude change while accounting for the endpoints' latitudes. Its inverse gives the smaller angle at Earth's centre.
- Apply one declared radius consistently
Multiplying by a mean radius yields kilometres; a defined conversion produces miles. Changing radius or mixing units midway would make segments in the same itinerary inconsistent.
- Add ordered segments for several stops
For A–B–C, calculate A–B and B–C separately, then sum them. The direct A–C separation is a different question and will usually be shorter.
Straight-line separation and journey distance should never share a label
Spherical surface estimate
This result is useful for orientation, approximate city spacing, and comparing an ordered set of coordinate legs. It ignores road geometry, borders, ferries, terrain, and access restrictions.
Road or rail route
A route engine uses a transport network and rules. Its distance may be much longer, and it can change when closures or permitted modes change. This page does not obtain that route behind the scenes.
Travel budget
Use the actual planned route distance in the fuel cost calculator, because a great-circle estimate is not evidence of how far a vehicle will travel.
Review ambiguous matches and model uncertainty
- Confirm the resolved city, region, country, and displayed coordinates before calculating. A confident formula cannot repair the wrong Springfield or an airport selected instead of a city centre.
- Expect different services to use different representative points for a city. Administrative centroid, downtown point, and postal locality can produce modestly different separations without any arithmetic error.
- Earth is not a perfect sphere. A mean-radius haversine result is a transparent approximation; high-accuracy surveying, aviation, and legal boundary work need an ellipsoidal geodesic and an appropriate datum.
- Round the output to match the purpose and coordinate quality. A geocoder result should not be presented as millimetre-level geodesy merely because floating-point arithmetic returns many digits.
Carry a defensible distance into the next planning tool
If a route planner supplies a road distance, save that value and its route date before checking tolls with the relevant facility operators or a route-aware toll service. Toll facilities and rates are route-specific, while this coordinate result is not. If you instead have two odometer readings and a refill quantity, the mileage calculator measures observed fuel economy without needing city coordinates at all.
The displayed endpoint audit is part of the answer, not decoration. Keep the matched place names, coordinates, ordered stop sequence, distance unit, spherical-model statement, and calculation time together. Those details let someone reproduce the estimate and understand why it may differ from a map's route distance.