ThisCalculator

Auto and travel

Calculate Distance: Formula, Examples, and Limits

Updated · Standard formula, shown below

Distance 3,935.75 km
Distance
2,445.56 mi
Result
Start latitude
40.7128 degrees
You entered
Start longitude
-74.006 degrees
You entered

Calculate Distance: Formula, Examples, and Limits

A distance map calculator works out the straight-line distance between two points from their coordinates. Enter each point’s latitude and longitude in decimal degrees, and it returns the distance in kilometres, plus the equivalent in miles.

Formula

This calculator uses the haversine formula, which estimates the great-circle distance between two locations on a spherical Earth:

a = sin²(Δφ / 2) + cos(φ₁) cos(φ₂) sin²(Δλ / 2)
d = 2R asin(√a)

Here, φ₁ and φ₂ are the start and end latitudes, λ₁ and λ₂ are their longitudes, and Δφ and Δλ are the differences between those coordinates. The calculator accepts degrees and uses degree-based trigonometric functions. R is the assumed Earth radius, 6,371 kilometres; d is the resulting distance in kilometres. Miles are calculated by dividing kilometres by 1.609344. The calculation is an approximation because Earth is not a perfect sphere.

Worked Example

Using the defaults, the start point is 40.7128° N, 74.0060° W, and the end point is 34.0522° N, 118.2437° W. These coordinates are commonly associated with New York City and Los Angeles. West longitudes are negative, so the signs are important.

  1. Find the coordinate differences: Δφ = 34.0522 − 40.7128 = −6.6606°, and Δλ = −118.2437 − (−74.0060) = −44.2377°.
  2. Substitute those values into the haversine expression. The intermediate value a is approximately 0.0924.
  3. Calculate d = 2 × 6,371 × asin(√0.0924), giving approximately 3,936 km.
  4. Convert to miles: 3,936 ÷ 1.609344 ≈ 2,446 miles.

Rounded to two decimal places, the outputs are approximately 3,936.00 km and 2,446.00 mi. The exact displayed values depend on the full-precision intermediate calculation.

What a Distance Map Measures

A map can show several different meanings of distance. This calculator measures the shortest surface route between two points on a spherical Earth, following a great-circle arc. It does not measure the length of a road, a hiking trail, a flight plan, or a route that avoids obstacles.

For example, the direct distance between two cities may be shorter than the distance a car must travel because roads bend, follow terrain, and connect through specific crossings. A routing service needs road or path data in addition to coordinates. The calculator is useful for a quick geographic estimate, checking how far apart locations are, or comparing direct distances.

How to Enter Coordinates

Latitude tells how far north or south a point lies from the equator, while longitude indicates how far east or west it lies from the prime meridian. Decimal degrees are convenient for calculations: 40.7128° is a latitude in decimal form. If your coordinates are given in degrees, minutes, and seconds, convert them first using degrees + minutes/60 + seconds/3600, applying a negative sign for south or west.

  • Latitude must be from −90° to 90°; longitude must be from −180° to 180°.
  • Use negative latitude for the Southern Hemisphere and negative longitude for the Western Hemisphere.
  • Enter the first location in the start fields and the second in the end fields. Reversing them does not change the distance.
  • Use coordinates from the same datum or mapping source when precision matters.

A common mistake is treating west longitude as positive. For a point at 74.0060° W, enter −74.0060°, not 74.0060°. Another is entering minutes as if they were decimal fractions: 40° 30′ equals 40.5°, not 40.30°.

Accuracy and Limitations

The spherical-Earth assumption makes the haversine formula practical and widely useful for distances between geographic coordinates. It is not an exact geodesic calculation on Earth’s flattened, irregular shape. For everyday comparisons and many general mapping purposes, the difference is small; for surveying or other work requiring high precision, use a geodesic method based on an ellipsoid and suitable coordinate data.

Coordinate quality also limits the answer. A location pin may represent the centre of a building or area rather than a precise point. Displaying more decimal places does not make uncertain input more accurate. The result is a direct distance, not an estimate of travel time, fuel use, elevation gain, or route length.

Units matter too. The formula expects angular coordinates in degrees, not distances in metres or kilometres. This calculator converts the angles internally and reports kilometres and miles. One kilometre is about 0.621371 miles; one mile is exactly 1.609344 kilometres for this conversion.

Frequently Asked Questions

How do you calculate distance between two map points?
Use the latitude and longitude of both points in the haversine formula. It returns an estimate of the shortest surface distance along a spherical Earth.

Is this the driving distance?
No. It is a straight-line, great-circle distance. Driving distance requires a route network and may be longer because of roads and turns.

Can I use coordinates in degrees, minutes, and seconds?
Convert them to decimal degrees first. Divide minutes by 60 and seconds by 3,600, then add those fractions to the degrees. Make south and west values negative.

Why is the map distance different from my route app?
A route app measures travel along available roads or paths, while this calculation measures direct distance. Differences in the selected points can also affect the comparison.

Does the order of the two locations matter?
No. The distance from point A to point B is the same as from point B to point A, although their start and end coordinates are entered in different fields.

Related

Formula used
in lat1 | Start latitude | degrees | 40.7128 | -90
in lon1 | Start longitude | degrees | -74.0060
in lat2 | End latitude | degrees | 34.0522 | -90
in lon2 | End longitude | degrees | -118.2437
out distance | Distance | km | 6371 * 2 * asin(sqrt(sind((lat2 - lat1) / 2)^2 + cosd(lat1) * cosd(lat2) * sind((lon2 - lon1) / 2)^2)) | 2
out miles | Distance | mi | distance / 1.609344 | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.