Distance Matrix API (Legacy)

Get the travel distance and time for a matrix of origins and destinations.


Get Started

Start building with the Distance Matrix API.

Get started with Google Maps Platform

Create an account, generate an API key, and start building.

Make a distance matrix request

Get the travel distance and journey duration for a matrix of origins and destinations.

Client libraries

Use Java, Python, Go, or Node.js client libraries to work with Google Maps Services on your server.

OpenAPI Specification

Get the OpenAPI specification for the Distance Matrix API, also available as a Postman collection.

Features

Learn about core features of the Distance Matrix API.

Get traffic information

Make a distance matrix request that calculates travel time based on current traffic conditions.

Specify side of road

Specify whether a calculated route should pass through a particular side of the road.

Example app

Run live code samples on your local machine and favorite code playgrounds with the Maps JavaScript API.

Distance Matrix Service

Use the DistanceMatrixService object to fetch the distances between a set of locations.

Help & support

Get help. Give help. Join the community.

Stack Overflow

Get help. Give Help. Build Maps karma.

Issue Tracker

Report a bug or open a feature request.

Platform status

Find out about platform incidents and outages.

Support

Get help from the Google Maps Platform team.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-27 UTC.