Measurement tool

Distance matrix calculator

Straight-line distances between every pair of up to 50 points, in one table.

Short answer

Add points by clicking or searching. As soon as there are two, a table appears with the straight-line distance between every pair, in kilometers. It holds up to 50 points, which is 1,225 pairs.

Worked example: five state capitals

FromOlympiaDenverAustinAtlantaAlbany
Olympia, WA01,6542,8493,5353,841
Denver, CO1,65401,2411,9472,618
Austin, TX2,8491,24101,3162,534
Atlanta, GA3,5351,9471,31601,355
Albany, NY3,8412,6182,5341,3550
Kilometers between capitol points, haversine on a sphere of radius 6,371.0088 km.

How to use it

  1. Click the map or search to add points. Each gets a number on the map.
  2. With two or more points, the table appears. Rows and columns use the same numbers as the pins.
  3. Read any cell for the distance in kilometers between its row point and its column point. The diagonal is zero.
  4. Keep adding points up to 50. The table scrolls inside its box when it grows.
  5. 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.

  1. 01Photon geocoder (OpenStreetMap data)

How every number is computed: methodology. Spotted a wrong figure? Report an error.