Places UI Kit: A ready-to-use library that provides room for customization and low-code development. Try it out, and share yourinput on your UI Kit experience.

Route Matrix class overview

European Economic Area (EEA) developers If your billing address is in the European Economic Area, effective on 8 July 2025, the Google Maps Platform EEA Terms of Service will apply to your use of the Services. Functionality varies by region.Learn more.

Introduction

TheRouteMatrix class returns distances and travel times for a matrix of routes between different origin and destination locations. Calculate travel times and distances for multiple destinations for up to 625 route elements.

Need Driving Routes? If you are interested in route directions, use theRoute class.

Migrating? If you are migrating from the Distance Matrix Service (Legacy) to theRouteMatrix class, seeMigrate to the Route Matrix class.

Why use theRouteMatrix class?

With theRouteMatrix class, you can determine the most efficient routes for dispatch scheduling, such as:

  • How best to assign a set of workers to pick up a series of packages
  • Determine the best warehouse from which to ship packages to their final destination

What can you do with theRouteMatrix class?

With theRouteMatrix class, you can get a matrix of possible routes between many start and end locations. You can specify multiple origins and destinations per server-side request with the number of origins times the number of destinations up to 625.

You can request these kinds of route data to determine the most efficient way to route passengers, shipments, or workers between multiple origins and destinations:

  • Distance in kilometers or miles for a selected travel mode
  • Estimated travel time in traffic

Next steps

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-10-02 UTC.