How to Calculate Distance on Google Maps

Google Maps Coordinate Distance Calculator

How to get coordinates: On Google Maps, right-click any point on the map. The first numbers you see are the Latitude and Longitude. Click them to copy, then paste them below.

Point A (Starting Point)

Point B (Destination)

Kilometers (km) Miles (mi) Nautical Miles (nm)

How to Calculate Distance on Google Maps

Calculating the distance between two points is one of the most useful features of modern mapping technology. Whether you are planning a flight, measuring a property, or just curious about the straight-line distance (also known as "as the crow flies"), Google Maps provides the data needed for these calculations.

Using the Built-In Google Maps Measure Tool

If you are using the Google Maps website or app directly, follow these steps:

  1. Open Google Maps: Navigate to the location you want to start from.
  2. Set Start Point: Right-click on the starting point and select "Measure distance."
  3. Set Destination: Click anywhere else on the map to create a path. Google will automatically display the total distance at the bottom of the screen.

Calculating Distance Using Coordinates

This calculator uses the Haversine Formula. This mathematical equation accounts for the Earth's curvature to find the shortest distance between two points on a sphere. This is different from driving directions, which must follow roads and traffic patterns.

Practical Examples

Consider a trip from New York City (40.71, -74.00) to Los Angeles (34.05, -118.24):

  • Straight-Line Distance: Approximately 2,445 miles (3,935 km).
  • Driving Distance: Typically around 2,790 miles (4,490 km) depending on the highway route.

Why is the straight-line distance different from driving distance?

Straight-line distance (Geodesic distance) represents the absolute shortest path. Driving distance is always longer because it is constrained by geography, infrastructure, and the non-linear nature of road networks. Use this calculator for navigation planning, radio range estimation, or scientific measurements.

function calculateMapDistance() { var lat1 = parseFloat(document.getElementById('lat1').value); var lon1 = parseFloat(document.getElementById('lon1').value); var lat2 = parseFloat(document.getElementById('lat2').value); var lon2 = parseFloat(document.getElementById('lon2').value); var unit = document.getElementById('unit').value; var resultDiv = document.getElementById('distanceResult'); if (isNaN(lat1) || isNaN(lon1) || isNaN(lat2) || isNaN(lon2)) { resultDiv.style.display = 'block'; resultDiv.style.backgroundColor = '#fce8e6'; resultDiv.style.borderColor = '#d93025'; resultDiv.innerHTML = 'Error: Please enter valid numeric coordinates for both points.'; return; } // Earth's radius in various units var R = 6371; // Kilometers if (unit === 'mi') R = 3958.8; if (unit === 'nm') R = 3440.1; var dLat = (lat2 – lat1) * Math.PI / 180; var dLon = (lon2 – lon1) * Math.PI / 180; var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon/2) * Math.sin(dLon/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var distance = R * c; resultDiv.style.display = 'block'; resultDiv.style.backgroundColor = '#e8f0fe'; resultDiv.style.borderColor = '#1a73e8'; var unitLabel = "km"; if (unit === 'mi') unitLabel = "miles"; if (unit === 'nm') unitLabel = "nautical miles"; resultDiv.innerHTML = '
Total Distance
' + '
' + distance.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) + ' ' + unitLabel + '
' + '
Calculation based on the Haversine formula (Earth radius: ' + R + ' ' + unit + ')
'; }

Leave a Comment