If you've got the latitude and longitude, you can use the Haversine formula to calculate the distance between them - assuming you want "straight line" distance.

EDIT: Okay, now you've actually told us what you want, I suspect you need to use the Directions API. You'll need to make a web request to the appropriate URL with your parameters, specifying either XML or JSON output - which you'll then need to parse.

Note that "JSON" != "Javascript-based". Think of JSON as a data serialization format which just happens to be executable Javascript.

Answer from Jon Skeet on Stack Overflow
🌐
Daft Logic
daftlogic.com › projects-google-maps-distance-calculator.htm
Distance Calculator
You can use this distance calculator to find out the distance between two or more points anywhere on the earth. In other words, the distance between A and B. Click once on the map to place the first marker and then click again to position the second marker. The distance between the points will ...
🌐
Google Maps Platform
mapsplatform.google.com › google maps platform › resources › blog › how calculate distances map maps javascript api
How to calculate distances between points with the Maps JavaScript API – Google Maps Platform
November 7, 2019 - function haversine_distance(mk1, mk2) { var R = 3958.8; // Radius of the Earth in miles var rlat1 = mk1.position.lat() * (Math.PI/180); // Convert degrees to radians var rlat2 = mk2.position.lat() * (Math.PI/180); // Convert degrees to radians ...
Discussions

java - Calculate distance using google map given a latitude and longitude - Stack Overflow
I am developing a desktop application and I have two point (latitude, longitude). How can I get the distance between these two points? I have looked at the API and most of them are javascript or web More on stackoverflow.com
🌐 stackoverflow.com
Calculate distance between two points in google maps V3
How do you calculate the distance between two markers in Google maps V3? (Similar to the distanceFrom function inV2.) Thanks.. More on stackoverflow.com
🌐 stackoverflow.com
coordinate system - What formula is used for distance between 2 points in Google Maps? - Geographic Information Systems Stack Exchange
What formula is used by Google Maps for calculating the shortest distance between 2 points (having their Lat, Lng coordinates)? Is it purely based on Haversine? Or is it something different? Is the... More on gis.stackexchange.com
🌐 gis.stackexchange.com
January 11, 2014
How can I calculate the distance between two points using Latitude and Longitude?
u/PercivalFailed - Your post was submitted successfully. Once your problem is solved, reply to the answer(s) saying Solution Verified to close the thread. Follow the submission rules -- particularly 1 and 2. To fix the body, click edit. To fix your title, delete and re-post. Include your Excel version and all other relevant information Failing to follow these steps may result in your post being removed without warning. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/excel
16
6
May 21, 2025
🌐
Google Support
support.google.com › docs › thread › 137329980 › how-to-calculate-distance-between-latitude-longitude-coordinates
How to calculate distance between latitude & longitude coordinates? - Google Docs Editors Community
November 26, 2021 - Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on
🌐
NOAA
nhc.noaa.gov › gccalc.shtml
Latitude/Longitude Distance Calculator
Latitudes and longitudes may be entered in any of three different formats, decimal degrees (DD.DD), degrees and decimal minutes (DD:MM.MM) or degrees, minutes, and decimal seconds (DD:MM:SS.SS). Important Note: The distance calculator on this page is provided for informational purposes only.
🌐
SunEarthTools
sunearthtools.com › tools › distance.php
Distance direction calculating between two location on the planet directly on the map
Drag the marker on map to calculate distance (km, meters, mile, foot) and bearing angle of direction on google map, between two points of the earth. Calculation of average speed or time spent. ... Valid value for the latitude are from -90.0° to 90.0° for the longitude are from -180.0° to ...
🌐
Labnol
labnol.org › google-maps-sheets-200817
Google Maps Formulas for Google Sheets - Digital Inspiration
Calculate distances between two cities or any addresses. Calculate the travel time (walking, driving or biking) between two points. Get the latitude and longitude co-ordinates of any address on Google Maps.
Find elsewhere
🌐
Quora
quora.com › How-can-I-calculate-the-distance-between-multiple-locations-given-by-their-latitude-longitude-coordinates-Google-Maps
How to calculate the distance between multiple locations given by their latitude/longitude coordinates (Google Maps) - Quora
Answer: When I was flying and when I was the navigator on several sailing trips, I used the following equations: A great circle route is the shortest distance between two points on a sphere (and earth). Hi is initial heading (0º being north and going to clockwise back to north at 360º), D is di...
🌐
Omni Calculator
omnicalculator.com › other › latitude-longitude-distance
Latitude Longitude Distance Calculator
January 18, 2024 - ... d = 2R × sin⁻¹(√[sin²((θ₂ - θ₁)/2) + cosθ₁ × cosθ₂ × sin²((φ₂ - φ₁)/2)]). ... The distance between any two adjacent latitudes is approximately 69 miles or 111 km.
🌐
Medium
medium.com › analytics-vidhya › turn-right-in-2-miles-finding-distances-using-the-google-maps-api-and-pandas-fef8554f0b7d
Turn Right in 2 Miles: Simple Method to Find Distance Using the Google Maps API and Pandas | by Svideloc | Analytics Vidhya | Medium
January 18, 2020 - Before accessing the API, you will need to first create an account with the Google Maps Platform. Note that you will have to put payment information in, but you get $200 in monthly credit for free access. Additional pricing can be found here if you need to access the API more. Look to the Distance Matrix cell. I am using data from Kaggle, which can be found here. Depending on what you are doing with your data, you may want to calculate the distance differently. Below, I will discuss two popular ways to calculate distance using triangles (Pythagorean theorem).
🌐
Google Groups
groups.google.com › g › django-users › c › N18j8kvMDR4
Calculate distance between 2 latitude/longitude Point
a = sin(dLat/2) * sin(dLat/2) + cos(radians(latitude1)) * cos(radians(latitude2)) * sin(dLong/2) * sin(dLong/2) ... Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message ... Geopy has a distance function build ...
🌐
Calculator.net
calculator.net › home › math › distance calculator
Distance Calculator
In the haversine formula, d is the distance between two points along a great circle, r is the radius of the sphere, ϕ1 and ϕ2 are the latitudes of the two points, and λ1 and λ2 are the longitudes of the two points, all in radians.
🌐
Map Developers
mapdevelopers.com › distance_finder.php
Google Maps Distance Calculator | Map Developers
To measure the distance on the google maps distance calculator tool. First zoom in, or enter the address of your starting point. Then draw a route by clicking on the starting point, followed by all the subsequent points you want to measure. You can calculate the length of a path, running route, ...
🌐
Movable Type
movable-type.co.uk › scripts › latlong.html
Calculate distance and bearing between two Latitude/Longitude points using haversine formula in JavaScript
(Out of sheer perversity – I’ve ... and bearings in degrees (either decimal or degrees/minutes/seconds) need to be converted to radians, rad = deg⋅π/180....
🌐
Google
developers.google.com › google maps platform › web services › distance matrix api (legacy) › distance matrix api (legacy) overview
Distance Matrix API (Legacy) overview | Google for Developers
The Distance Matrix API calculates travel distance and time between multiple origins and destinations, supporting various modes of transport like driving, biking, transit, or walking · This API is ideal for optimizing logistics, such as determining efficient delivery routes or assigning workers ...
🌐
Latitude Longitude Data
latlongdata.com › home › distance calculator
Distance Calculator - Latitude Longitude Data
November 6, 2025 - In the "Start Location" field, enter a full address, city, or latitude/longitude coordinates in decimal format (e.g., 34.0522, -118.2437). In the "End Location" field, enter the destination address or coordinates using the same format. Click Calculate: Press the "Calculate" button to process ...
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-calculate-distance-between-two-locations-in-android
How to Calculate Distance Between two Locations in Android? | GeeksforGeeks
January 24, 2021 - import android.os.Bundle; import android.widget.Toast; import androidx.fragment.app.FragmentActivity; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.maps.android.SphericalUtil; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; // below are the latitude and longitude // of 2 different locations. LatLng sydney = new LatLng(-34, 151); LatLng Brisbane = new LatLng(-27.470125, 153.021072); Double distance; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified // when the map is ready to be used.