Skip to content

Distance Calculator & Unit Converter

Calculate the great-circle distance between two GPS coordinates in miles, then convert distances between miles, kilometers, feet, and meters for free.

Distance Calculator and Unit Converter

1Coordinate Distance Calculator

2Unit Converter

Loading calculator...
๐Ÿ“š

Documentation

What is the distance calculator and unit converter?

A distance calculator finds how far apart two points are. This tool does two separate jobs. The first section calculates the straight-line distance between two GPS coordinates, given as latitude and longitude, and shows the result in miles. The second section converts a distance value between miles, kilometers, feet, and meters.

How to calculate distance between two GPS coordinates

Enter the latitude and longitude of the first point, then the latitude and longitude of the second point. Latitude must be between -90 and 90. Longitude must be between -180 and 180. The distance appears automatically in miles once all four values are filled in. There is no separate calculate button; the result updates as soon as valid numbers are entered.

The Haversine formula

The calculator uses the Haversine formula. This formula treats the Earth as a sphere and finds the shortest path between two points along its surface, known as the great-circle distance.

a=sinโก2(ฮ”ฯ•2)+cosโก(ฯ•1)cosโก(ฯ•2)sinโก2(ฮ”ฮป2)a = \sin^2\left(\frac{\Delta\phi}{2}\right) + \cos(\phi_1)\cos(\phi_2)\sin^2\left(\frac{\Delta\lambda}{2}\right)

c=2โ‹…atan2โก(a,1โˆ’a)c = 2 \cdot \operatorname{atan2}\left(\sqrt{a}, \sqrt{1-a}\right)

d=Rโ‹…cd = R \cdot c

Here, ฯ† (phi) is latitude, ฮป (lambda) is longitude in radians, and ฮ” means "the difference between the two points." R is the Earth's radius. The calculator uses 3,959 miles, the average radius in that unit, so the result comes out directly in miles.

Worked example

Find the distance between New York City (40.7128, -74.0060) and Los Angeles (34.0522, -118.2437).

Plugging these coordinates into the formula above gives a central angle of about 0.618 radians. Multiplying by the Earth's radius, 3,959 miles, gives a distance of about 2,445.71 miles. That is the straight-line, "as the crow flies" distance, not the distance a car would drive.

How to convert distance units

Choose a starting unit from the "From Unit" list, type a value, and choose a target unit from the "To Unit" list. The converted result appears automatically and can be copied with the "Copy Result" button. The converter supports four units: miles, kilometers, feet, and meters.

Unit conversion formula

The calculator treats miles as the base unit. To convert a value, it first turns the input into miles, then turns that number of miles into the target unit:

miles=valuefactorfromresult=milesร—factorto\text{miles} = \frac{\text{value}}{\text{factor}_{\text{from}}} \qquad \text{result} = \text{miles} \times \text{factor}_{\text{to}}

The factors used are:

Unit1 mile equals
Kilometers1.60934
Feet5,280
Meters1,609.34

Worked examples

10 miles to kilometers: 10 รท 1 ร— 1.60934 = 16.09 kilometers.

5 kilometers to miles: 5 รท 1.60934 = 3.11 miles.

1 mile to feet: 1 ร— 5,280 = 5,280 feet, the standard definition of a mile.

Supported units

This converter works with exactly four units: miles, kilometers, feet, and meters. It does not currently support millimeters, centimeters, inches, or yards. Converting between two of the four supported units, in either direction, works correctly.

Straight-line distance versus travel distance

The distance the calculator returns is a straight line between two points, not a route. Driving or flying distances are almost always longer, because roads bend around obstacles and flight paths must account for air traffic corridors. A straight-line distance is useful for a quick estimate, for checking radio or line-of-sight range, or for comparing how close two places are in general.

The Haversine formula also assumes the Earth is a perfect sphere. The real Earth bulges slightly at the equator, so results can be off by up to about half a percent. For most everyday purposes, including trip planning and general geography, this level of accuracy is more than enough.

Frequently asked questions

What units does the unit converter support?

Miles, kilometers, feet, and meters. Any of the four can be converted to any other.

Does the coordinate calculator show results in kilometers?

No. The coordinate distance calculator always shows its result in miles. To see the same distance in kilometers, take that number and use the unit converter section, or multiply it by 1.60934.

Why is my distance different from what a map app shows?

Map apps such as Google Maps calculate a driving, walking, or transit route, which follows roads and paths. This calculator finds the straight-line distance between two coordinates, which is normally shorter.

What is the valid range for latitude and longitude?

Latitude runs from -90 to 90, with negative values south of the equator. Longitude runs from -180 to 180, with negative values west of the prime meridian. Entering a number outside these ranges will not produce a result.

How accurate is the Haversine formula?

It is accurate to within roughly half a percent, because it assumes the Earth is a perfect sphere rather than its true, slightly flattened shape. For city-to-city distances, the error is usually just a few kilometers.

Can I convert negative distances?

No. A distance value must be zero or positive. Negative numbers are not accepted by the converter.