Info Nuggets
from the Help Desk
Imagine you want to know how far it is to drive from one place to another, and how long it will take—including real routes, traffic, and road conditions. The Google Maps Distance Matrix API is a tool that lets websites and apps do exactly that.
Instead of only showing a map, this service works “behind the scenes” and quickly answers questions like “What’s the distance in miles and the driving time between Zip Code A and Zip Code B?” You just provide the starting point and the destination, and the API sends back all the details—instantly and accurately, using the same up-to-date information that powers Google Maps.
Businesses use the Distance Matrix API to make things easier for their customers, for example:
- Calculating delivery costs by distance,
- Letting users pick the fastest or shortest route,
- Showing how far a service technician or delivery truck needs to drive.
You don’t need to be a programmer to use it—just follow a few steps to connect your website or tool to Google’s powerful mapping engine, and you’ll be able to automatically calculate distances and travel times for any addresses or zip codes you need.
Here is a step-by-step, non-technical tutorial to help you create and generate a Google Maps Distance Matrix API key and prepare it for use in your web based application—no coding experience needed.
Step 1: Create a Google Account (if you don’t have one)
- Go to https://accounts.google.com/
- Click "Create account" and follow instructions.
Step 2: Sign Up for Google Cloud
- Visit https://console.cloud.google.com/
- Sign in with your Google account.
- Click "Agree & Continue" if asked, and follow prompts.
Step 3: Create a New Google Cloud Project
- In the top left, click the project dropdown (it might say “Select a project”).
- Click "NEW PROJECT".
- Enter a project name (example:
DistanceCalculator). - Click “Create”.
Step 4: Enable Billing (Required by Google)
- Click the “☰” menu > Billing.
- Follow the prompts to add your payment info (Google gives you free credits and won’t bill for light usage).
- Attach your billing account to the project you created.
Step 5: Enable the Distance Matrix API
- Go to the main menu (☰) > APIs & Services > Library.
- In the search bar, type “Distance Matrix API”.
- Click it when it appears.
- Click the blue “Enable” button.
Step 6: Create an API Key
- Still in the Console, go to APIs & Services > Credentials.
- Click on "+ CREATE CREDENTIALS", choose API key.
- Copy your new API key and save it somewhere private.
Step 7: Restrict Your API Key (Important for Security)
- In the list of API keys, click “Edit” next to your new key (pencil icon).
- Under “API restrictions”, select “Distance Matrix API” only.
- Under “Website restrictions” or “HTTP referrers”, click Add.
- Enter your website address (e.g.,
https://yourwebsite.com/*) - Click Save.
Step 8: Verify It Works
- Try using your API key in a test URL. Replace
YOUR_API_KEY,ORIGIN, andDESTINATIONwith real values:
texthttps://maps.googleapis.com/maps/api/distancematrix/json?origins=10001&destinations=90210&key=YOUR_API_KEY
- Paste this URL in your browser. You should see some JSON text (not an error).
Step 9: Use It in Your Web based application
- Safely copy your API key into your web based application as directed by the tool’s setup instructions.
- Keep your API key private and restricted for your website only.

