Measurement tool
Distance matrix calculator
Straight-line distances between every pair of up to 50 points, in one table.
Short answer
Worked example: five state capitals
| From | Olympia | Denver | Austin | Atlanta | Albany |
|---|---|---|---|---|---|
| Olympia, WA | 0 | 1,654 | 2,849 | 3,535 | 3,841 |
| Denver, CO | 1,654 | 0 | 1,241 | 1,947 | 2,618 |
| Austin, TX | 2,849 | 1,241 | 0 | 1,316 | 2,534 |
| Atlanta, GA | 3,535 | 1,947 | 1,316 | 0 | 1,355 |
| Albany, NY | 3,841 | 2,618 | 2,534 | 1,355 | 0 |
How to use it
- Click the map or search to add points. Each gets a number on the map.
- With two or more points, the table appears. Rows and columns use the same numbers as the pins.
- Read any cell for the distance in kilometers between its row point and its column point. The diagonal is zero.
- Keep adding points up to 50. The table scrolls inside its box when it grows.
- Clear removes every point and the table.
Reading the matrix
Row and column numbers match the numbered pins on the map. The cell where row 2 meets column 4 is the distance from point 2 to point 4. The table is symmetric, because the great-circle distance from A to B equals the distance from B to A, and the diagonal is zero.
Values are rounded to whole kilometers. Multiply by 0.621371 for statute miles or by 0.539957 for nautical miles.
What a distance matrix is for
A matrix is the input to most routing and clustering problems. With it you can pick the most central of several offices, find which two sites are closest, or check a delivery plan by hand. Sorting a row gives the nearest neighbors of one point.
For an ordered trip through the points rather than all pairs, use the multi-stop route distance tool.
Straight lines only
This matrix uses straight-line distances only. Road distances between many pairs would need one routing request per pair, and the free public routers this site uses are not built for that load. For a few road distances, measure pairs one at a time with the two-place tool and its driving comparison.
Tips for bigger tables
Add points in a meaningful order, such as west to east or by priority, because the numbers are all you have to tell them apart. Write down which number is which place as you add them.
To move the table into a spreadsheet, select it with your mouse and paste. Most spreadsheets keep the rows and columns.
Questions people ask
How many points can the matrix hold?
50, which gives 1,225 distinct pairs.
Are the distances in miles?
The table shows kilometers. Multiply by 0.621371 for miles.
Can it give driving distances?
No. It is a straight-line matrix.
Sources and data as of
Data as of: computed from the haversine formula and the capital coordinates stored on this site.
How every number is computed: methodology. Spotted a wrong figure? Report an error.