e.g. New York City
e.g. Los Angeles
Distance Calculator
About the Distance Calculator
Plan routes and compare travel options in seconds with ProcalcAI’s Distance Calculator. You use the Distance Calculator when you’re mapping out a trip, checking logistics, or just trying to understand how far two places really are beyond what a map “feels” like. Travel coordinators, delivery dispatchers, and real estate agents use it to estimate drive times, compare straight-line distance to road distance, and share clear numbers with clients or teams. Say you’re scheduling a same-day pickup from Dallas to Austin and need to confirm the driving distance, the approximate time on the road, and how that compares to a direct flight option before you commit to a delivery window. You enter two locations—city names, addresses, or coordinates—and you get straight-line distance, driving distance, flight time, and travel estimates in miles and kilometers, with results you can use immediately for planning, budgeting, and timing.
How do I calculate the distance between two cities?
Enter the two city names (or addresses/coordinates) and the calculator returns the straight-line (great-circle) distance in miles and kilometers. Straight-line distance uses Earth’s radius and the Haversine-based formula shown (3959 * 2 * atan2(...)) to estimate the shortest path over the globe. If you also select driving, it will estimate route distance and time based on roads rather than “as the crow flies.”
How is the straight-line distance between two points on Earth calculated? The straight-line distance between two points on Earth is calculated using the haversine formula, which determines the great-circle distance. This method accounts for the Earth's spherical shape, using latitude and longitude coordinates to find the shortest path over its surface.
What is the haversine formula for calculating distance? The haversine formula calculates the great-circle distance between two points on a sphere given their longitudes and latitudes. The formula is: Distance = 2r × arcsin(√[sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)]), where r is the sphere's radius, φ is latitude, and λ is longitude.
What is the difference between straight-line distance and driving distance? Straight-line distance, also known as 'as the crow flies,' is the shortest possible distance directly between two points, ignoring obstacles. Driving distance, conversely, accounts for roads, traffic, and geographical barriers, representing the actual distance traveled by vehicle.
Distance Calculator
ProCalc.ai’s Distance Calculator (part of our Geography tools) computes the straight-line (“as-the-crow-flies”) distance between two points using their latitude and longitude. It’s handy for trip planning, logistics, fieldwork, drone/aviation estimates, and anyone who needs a quick reality check on how far two locations are without manually measuring on a map. Under the hood, it uses the haversine-style great-circle method with Earth’s radius in miles (3959), calculating: `3959 * 2 * atan2(√a, √(1−a))`, where *a* depends on the coordinate differences. You can read results in miles or kilometers, then use that baseline to compare with driving distance or estimate flight time.
Example 1 (NYC → LA): Latitude A = 40.7128, Longitude A = −74.0060; Latitude B = 34.0522, Longitude B = −118.2437. The straight-line distance comes out to about 2,446 miles (~3,936 km)—useful for rough flight-time estimates before you factor in routing and winds.
Example 2 (London → Paris): (51.5074, −0.1278) to (48.8566, 2.3522) is roughly 214 miles (~344 km) in a straight line. If you’re comparing options (train vs. driving), this helps you sanity-check travel estimates: driving distance will be longer than the great-circle distance because roads don’t follow a perfect arc.
Distance Calculator — Frequently Asked Questions(8)
Common questions about distance.
Last updated Apr 2026
You’re planning a weekend road trip and trying to decide whether to drive straight through or stop overnight. You know the two endpoints (say, your home and a national park), but you need a quick way to estimate how far apart they are and how long travel might take. A distance calculator based on latitude and longitude gives you the straight-line (“as-the-crow-flies”) distance immediately—useful for planning, comparing routes, estimating fuel, or sanity-checking map results.
What Is Distance Calculator?
Many apps also show driving distance and flight time, but those require road networks, speed assumptions, and routing data. The coordinate-based calculation covered here is the core “straight-line” distance that works anywhere on Earth, even over oceans or remote areas.
Context fact: Earth’s mean radius is about 6,371 km (≈ 3,959 miles). NASA commonly uses ~6,371 km as a representative Earth radius for many calculations and visualizations, which is why you’ll often see 3,959 miles used in mile-based formulas. (Source: NASA Earth fact resources; Gold-tier: NASA.gov)
The Formula (Haversine Logic)
Here are the steps, written as formulas. (Angles must be in radians.)
1) Convert degrees to radians Radians = Degrees × (π / 180)
2) Compute coordinate deltas Δlat = latB − latA Δlon = lonB − lonA
3) Compute the Haversine “a” value a_val = sin²(Δlat/2) + cos(latA) × cos(latB) × sin²(Δlon/2)
4) Compute the central angle (in radians) c = 2 × atan2( √a_val, √(1 − a_val) )
5) Compute distance (miles, using Earth radius 3,959 mi) Distance_miles = 3959 × c
If you want kilometers instead, use Earth radius ≈ 6,371 km: Distance_km = 6371 × c
What each piece means:
- a_val is a helper value that stays numerically stable even for small distances.
- atan2(y, x) safely computes an angle from a ratio while handling edge cases.
- Multiplying by Earth’s radius turns the angle into a real-world distance along Earth’s surface.
Step-by-Step Examples (Real Numbers)
### Example 1: New York City → Los Angeles (straight-line) Coordinates (approx): - NYC: latA = 40.7128°, lonA = −74.0060° - LA: latB = 34.0522°, lonB = −118.2437°
1) Convert to radians latA = 40.7128 × π/180 ≈ 0.7106 lonA = −74.0060 × π/180 ≈ −1.2916 latB = 34.0522 × π/180 ≈ 0.5943 lonB = −118.2437 × π/180 ≈ −2.0637
2) Deltas Δlat = 0.5943 − 0.7106 = −0.1163 Δlon = −2.0637 − (−1.2916) = −0.7721
3) Compute a_val sin²(Δlat/2) = sin²(−0.05815) ≈ (−0.05811)² ≈ 0.00338 sin²(Δlon/2) = sin²(−0.38605) ≈ (−0.3766)² ≈ 0.1418 cos(latA) ≈ cos(0.7106) ≈ 0.758 cos(latB) ≈ cos(0.5943) ≈ 0.828
a_val ≈ 0.00338 + (0.758 × 0.828 × 0.1418) 0.758 × 0.828 ≈ 0.627 0.627 × 0.1418 ≈ 0.0889 a_val ≈ 0.00338 + 0.0889 = 0.0923
4) Central angle c = 2 × atan2(√0.0923, √(1−0.0923)) √0.0923 ≈ 0.3038 √0.9077 ≈ 0.9527 atan2(0.3038, 0.9527) ≈ 0.308 c ≈ 2 × 0.308 = 0.616 rad
5) Distance Distance_miles = 3959 × 0.616 ≈ 2439 miles Distance_km = 6371 × 0.616 ≈ 3926 km
That’s in the ballpark of commonly cited NYC–LA great-circle distances (varies slightly by exact points).
### Example 2: London → Paris (straight-line) Coordinates (approx): - London: 51.5074°, −0.1278° - Paris: 48.8566°, 2.3522°
Radians: latA ≈ 0.8990, lonA ≈ −0.00223 latB ≈ 0.8527, lonB ≈ 0.04105
Deltas: Δlat = −0.0463 Δlon = 0.04328
a_val: sin²(Δlat/2) = sin²(−0.02315) ≈ 0.000536 sin²(Δlon/2) = sin²(0.02164) ≈ 0.000468 cos(latA) ≈ 0.622, cos(latB) ≈ 0.657
a_val ≈ 0.000536 + (0.622 × 0.657 × 0.000468) 0.622 × 0.657 ≈ 0.409 0.409 × 0.000468 ≈ 0.000191 a_val ≈ 0.000536 + 0.000191 = 0.000727
c: √a ≈ 0.02696, √(1−a) ≈ 0.99964 atan2(0.02696, 0.99964) ≈ 0.02697 c ≈ 2 × 0.02697 = 0.05394 rad
Distance: Distance_miles ≈ 3959 × 0.05394 ≈ 213.6 miles Distance_km ≈ 6371 × 0.05394 ≈ 343.7 km
### Example 3: Sydney → Melbourne (straight-line) Coordinates (approx): - Sydney: −33.8688°, 151.2093° - Melbourne: −37.8136°, 144.9631°
Radians: latA ≈ −0.5911, lonA ≈ 2.6391 latB ≈ −0.6593, lonB ≈ 2.5301
Deltas: Δlat = −0.0682 Δlon = −0.1090
a_val: sin²(Δlat/2) = sin²(−0.0341) ≈ 0.00116 sin²(Δlon/2) = sin²(−0.0545) ≈ 0.00297 cos(latA) ≈ 0.830, cos(latB) ≈ 0.790
a_val ≈ 0.00116 + (0.830 × 0.790 × 0.00297) 0.830 × 0.790 ≈ 0.656 0.656 × 0.00297 ≈ 0.00195 a_val ≈ 0.00116 + 0.00195 = 0.00311
c: √a ≈ 0.0558, √(1−a) ≈ 0.9984 atan2(0.0558, 0.9984) ≈ 0.0559 c ≈ 2 × 0.0559 = 0.1118 rad
Distance: Distance_miles ≈ 3959 × 0.1118 ≈ 442 miles Distance_km ≈ 6371 × 0.1118 ≈ 712 km
Common Mistakes to Avoid (Plus a Pro Tip)
Common Mistake #2: Swapping latitude and longitude. Latitude is north/south (−90 to +90). Longitude is east/west (−180 to +180). Mixing them can produce distances that look plausible but are incorrect.
Common Mistake #3: Using the wrong sign for west/south coordinates. West longitudes and south latitudes are negative by convention (e.g., Los Angeles longitude is about −118°). A sign error can move a point across the globe.
Common Mistake #4: Expecting driving distance from great-circle distance. Great-circle distance ignores roads, terrain, and detours. Driving distance is often 10–50% longer depending on geography and road layout.
Pro Tip: If you need a quick travel-time estimate from straight-line distance, sanity-check with realistic speeds. For example, commercial jets often cruise around 800–900 km/h, but gate-to-gate time includes climb, descent, taxi, and routing. For driving, average speed is usually far below highway speed limits once stops and traffic are included. (Authoritative aviation and roadway speed guidance varies by country; for U.S. road travel planning, FHWA resources are a good starting point—Gold-tier: fhwa.dot.gov.)
When to Use This Calculator vs. Doing It Manually
Distance Formula & Method
Distance (miles) = 3959 × 2 × atan2( √a, √(1 − a) )
This Distance Calculator uses the haversine method, a standard way to compute the great-circle distance between two points on a sphere from their latitudes and longitudes. “Great-circle” means the shortest path along the surface, like the route an airplane would take if it followed the curvature of Earth. The Earth isn’t a perfect sphere, but for most everyday geography use (city-to-city distances, travel estimates, mapping), the spherical approximation is accurate enough.
The reasoning starts with spherical geometry. If two points A and B lie on a sphere of radius R, the surface distance d equals the central angle c (in radians) between them times the radius: d = R × c. The hard part is finding c from latitude/longitude. Let latitude be φ (phi) and longitude be λ (lambda), measured in radians. Define Δφ = φB − φA and Δλ = λB − λA. The haversine identity gives a numerically stable way to compute the central angle even when points are close together: a = sin²(Δφ/2) + cos(φA) × cos(φB) × sin²(Δλ/2). Then c = 2 × atan2(√a, √(1 − a)). Finally d = R × c. In the calculator’s logic, R is 3959 miles (a commonly used mean Earth radius in miles), so the result is in miles.
Variables and units: Latitude A and B are φA and φB; Longitude A and B are λA and λB. Inputs are typically in degrees (e.g., 40.7128°), but the trig functions sin, cos, and atan2 require radians. Convert degrees to radians with radians = degrees × (π/180). Longitudes are positive east and negative west by convention; latitudes are positive north and negative south. The intermediate value a is unitless and lies between 0 and 1 (aside from tiny floating-point rounding).
If you want kilometers instead of miles, use the same method but change the radius. A common mean Earth radius is 6371 km. You can also convert after the fact: kilometers = miles × 1.609344, and miles = kilometers ÷ 1.609344.
Distance (kilometers) = 6371 × 2 × atan2( √a, √(1 − a) )
Worked example 1 (New York City to Los Angeles). Let A be (φA, λA) = (40.7128°, −74.0060°) and B be (34.0522°, −118.2437°). Convert to radians: φA = 40.7128×π/180 = 0.710572 rad, λA = −74.0060×π/180 = −1.291648 rad; φB = 34.0522×π/180 = 0.594323 rad, λB = −118.2437×π/180 = −2.063742 rad. Differences: Δφ = 0.594323 − 0.710572 = −0.116249; Δλ = −2.063742 − (−1.291648) = −0.772094. Compute a: sin²(Δφ/2) = sin²(−0.0581245) ≈ (−0.058092)² = 0.003374. sin²(Δλ/2) = sin²(−0.386047) ≈ (−0.3760)² = 0.1414. cos(φA)cos(φB) ≈ 0.7580×0.8285 = 0.6280. So a ≈ 0.003374 + 0.6280×0.1414 = 0.003374 + 0.0888 = 0.0922. Then c = 2×atan2(√0.0922, √(1−0.0922)) = 2×atan2(0.3036, 0.9528) ≈ 2×0.3086 = 0.6172 rad. Distance ≈ 3959×0.6172 = 2443 miles. In kilometers: 2443×1.609344 ≈ 3932 km.
Worked example 2 (London to Paris). A = (51.5074°, −0.1278°), B = (48.8566°, 2.3522°). Radians: φA = 0.898973, λA = −0.002231; φB = 0.852709, λB = 0.041054. Δφ = −0.046264; Δλ = 0.043285. sin²(Δφ/2) = sin²(−0.023132) ≈ (−0.023130)² = 0.000535. sin²(Δλ/2) = sin²(0.0216425) ≈ (0.021641)² = 0.000468. cos(φA)cos(φB) ≈ 0.6224×0.6579 = 0.4095. a ≈ 0.000535 + 0.4095×0.000468 = 0.000535 + 0.000192 = 0.000727. c = 2×atan2(√0.000727, √(1−0.000727)) = 2×atan2(0.02696, 0.99964) ≈ 2×0.02697 = 0.05394 rad. Distance ≈ 3959×0.05394 = 213.6 miles, or 213.6×1.609344 ≈ 343.7 km.
Edge cases and limitations matter. If A and B are identical, then Δφ = Δλ = 0, a = 0, c = 0, and distance is 0, which is correct. If the points are nearly antipodal (opposite sides of Earth), a approaches 1 and rounding can push a slightly above 1; robust implementations clamp a into [0, 1] before taking √(1−a). Also, this is surface distance on a sphere, not straight-line distance through Earth, and it ignores elevation. For high-precision geodesy (surveying, legal boundaries), you’d use an ellipsoidal model such as Vincenty or other WGS84-based methods; those are variations designed to account for Earth’s flattening and can differ by up to tens of kilometers on very long routes.
Distance Sources & References
Explore More Calculators
Content reviewed by the ProCalc.ai editorial team · About our standards
🔀 You Might Also Use
Percentage Calculator
Free Percentage Calculator — Calculate percentages instantly. Find percent change, discounts, tips, and more. Free math tool, no signup required.
MATHMortgage Calculator
Free mortgage calculator with payment breakdown, amortization schedule, extra payment scenarios, and 15 vs 30 year comparison.
FINANCEBMI Calculator
Free BMI Calculator — Calculate BMI. Check if weight is healthy based on height. AI-powered health tool.
HEALTHAge Calculator
Free Age Calculator — Calculate your age in years, months, days. Find day of week you were born. Instant results.
MATHExplore More Math Tools
Percentage Calculator
Free Percentage Calculator — Calculate percentages instantly. Find percent change, discounts, tips, and more. Free math tool, no signup required.
Division Calculator
Free Division Calculator — Divide any two numbers. See quotient, remainder, decimal result, and fraction form.
Celsius to Fahrenheit
Free Celsius to Fahrenheit Converter — Convert Celsius to Fahrenheit instantly. Enter a temperature in Celsius and get the Fahrenheit equivalent using.
Miles to Kilometers
Free Miles to Kilometers Converter — Convert miles to kilometers instantly with precise calculations. Get your distance in km, meters, and helpful ...
Age Calculator
Free Age Calculator — Calculate your age in years, months, days. Find day of week you were born. Instant results.
CM to Inch Bi-Directional Converter
Free CM to Inch Bi-Directional Converter — convert centimeters to inches and inches to centimeters. Free and accurate.
📖 Related Articles
Distance Calculator: How Far Is It Between Two Cities?
Figure out straight-line vs driving distance, sanity-check the numbers, and stop arguing about how far two cities really are.
6 min read
How GPS Calculates Distance (And Why It Is Not Always Right)
GPS distance is usually straight-line math between coordinates, not the path you drive or hike—so the number can be right and still feel wrong.
6 min read