Distance Matrix Calculator
Build a full N by N distance table from a list of coordinates, with haversine or Vincenty accuracy, in km, miles, nautical miles or metres.
Paste at least two coordinates to build the full distance matrix.
What is the Distance Matrix Calculator?
Paste a list of named coordinates and this tool builds the complete distance table: every point measured against every other point, ready to copy into a spreadsheet or feed into a routing or clustering script.
- Full N by N distance matrix from a plain coordinate list, up to 60 points
- Haversine (spherical) or Vincenty inverse (WGS-84 ellipsoid) on a toggle
- Kilometres, miles, nautical miles or metres, with sensible rounding
- Highlights the closest pair, the furthest pair and the average pair distance
- Reports lines it could not read instead of silently dropping them
- CSV export with row and column headers, computed entirely in your browser
How to use the Distance Matrix Calculator
- 1
Paste your coordinates, one "latitude, longitude, name" per line, or drop in GeoJSON Point features.
- 2
Choose the unit you want the table in: kilometres, miles, nautical miles or metres.
- 3
Pick haversine for speed or Vincenty for ellipsoidal accuracy.
- 4
Read the matrix, plus the closest pair, furthest pair and average distance below it.
- 5
Copy or download the table as CSV.
About the Distance Matrix Calculator
Paste a list of named coordinates and this tool builds the complete distance table: every point measured against every other point, ready to copy into a spreadsheet or feed into a routing or clustering script. It also picks out the closest pair, the furthest pair and the average distance across all unique pairs.
Two models are available. Haversine measures the great circle on a sphere of radius 6,371,008.8 metres and is accurate to about half a percent, which is fine for planning. Vincenty's inverse formula works on the WGS-84 ellipsoid and is accurate to well under a millimetre; where it fails to converge on a nearly antipodal pair, the tool says so and falls back to the haversine value rather than printing a wrong number.
This is straight-line distance on the globe, not driving distance — there is no road network involved, and nothing is uploaded. Every calculation runs locally in your browser, so customer addresses, depot locations and survey points stay on your machine.
Frequently asked questions
What is a distance matrix used for?
It is the input to almost every routing, clustering and facility-location problem. Travelling-salesman solvers, k-medoids clustering and "which depot is nearest" questions all start from a table of pairwise distances, and this builds that table without needing an API key.
Is this driving distance or straight-line distance?
Straight-line distance across the surface of the Earth, sometimes called as-the-crow-flies or great-circle distance. It ignores roads, rivers and terrain entirely, so real travel distance will always be longer — typically 20 to 40 percent longer on a road network.
What is the difference between haversine and Vincenty?
Haversine treats the Earth as a perfect sphere, so it is simple and fast but can be off by up to about half a percent. Vincenty's formula uses the WGS-84 ellipsoid, which is flattened at the poles, and gets to sub-millimetre accuracy at the cost of an iterative solve.
Why did Vincenty fail for some of my pairs?
Vincenty's inverse formula is known not to converge for points that are nearly antipodal — roughly on opposite sides of the planet. This tool detects that, counts the affected pairs, and quietly uses the haversine distance for those cells so the matrix stays complete.
How many points can I put in?
Up to 60, which produces a 3,600-cell table. Beyond that the table stops being readable in a browser and the CSV becomes the only useful output, so the tool asks you to trim the list rather than locking up the page.
Related tools
Distance Calculator
Calculate the straight-line distance and bearing between two points on a map by latitude/longitude using the Haversine formula — km, miles and nautical miles.
Route Distance Calculator
Add up the great-circle distance across a list of waypoints, with a per-leg table of distances and bearings in kilometres, miles and nautical miles.
Bearing Calculator
Calculate the initial and final bearing between two latitude/longitude points, with compass direction, quadrant bearing and great-circle distance.
Midpoint Calculator
Find the great-circle midpoint between two latitude/longitude points, or any waypoint along the route, in decimal degrees, DMS and DDM.
Rhumb Line Calculator
Work out the constant compass course and distance between two coordinates, the rhumb midpoint, and how much longer it is than the great circle.