Tools Distance, area and drive time
Distance Matrix Calculator
Paste or pick a list of places and get an N by N grid of distances. Useful for choosing a depot, a meeting city or a route order.
How to use it
- Paste the places into the box, one per line: city names, addresses or "lat, lng" pairs.
- Choose straight line (up to 50 places) or driving (up to 25).
- Press Build matrix. Each place is looked up in turn and the grid appears, darker cells for longer distances.
- Switch between miles and kilometres, and download the grid or the pair list as CSV.
How it works
Each line that is not a coordinate pair is geocoded with the Photon geocoder on OpenStreetMap data, one request at a time with a short pause between them, and the top hit is used; lines that cannot be found are listed. Straight-line cells are great-circle distances computed in the browser.
Driving cells come from one call to the public Valhalla sources-to-targets service. It is capped at 25 places because 25 by 25 is already 625 routes for a free shared server, and larger requests are refused or time out. Driving distances are on OpenStreetMap roads at posted speeds and can differ by direction.
Questions
- What is a distance matrix?
- A table with the same places as rows and columns where each cell is the distance from the row place to the column place. It is the input for route planning, choosing a central location, or clustering.
- How many places can I enter?
- Up to 50 for straight-line distances and 25 for driving distances. The driving cap is a limit of the free routing server.
- What is the difference between the two CSV files?
- The grid CSV mirrors the table, one row per place with one column per place. The pairs CSV has one row per from-to pair with the distance and, for driving, the minutes; it is the shape spreadsheets and databases prefer.
Related tools
All map tools, free and without an account. Location data is processed in your browser and by the open geocoding services named on the sources page; nothing is stored by this site.