Fix Google Maps Not Loading Correctly on Your Page
In this article
If Google Maps is not loading correctly on your page, the fix is usually one of a few specific things: a missing or incorrect API key, a JavaScript error blocking the map script, or a conflict with your site's theme or another plugin. This article walks through the most common causes and the exact steps to resolve them, from the simplest cache clear to more advanced troubleshooting.
Why Google Maps Fails to Render
Google Maps on a website is not a static image; it is a dynamic web application loaded through a JavaScript API. When it fails, the page typically shows a gray box, a blank area, or an error message like "This page can't load Google Maps correctly." This specific error is almost always generated by the Google Maps JavaScript API itself when it detects a problem with the request. The most frequent triggers are an invalid API key, a billing issue on the Google Cloud account, or the API being called without the necessary libraries enabled.
Another common cause is a JavaScript conflict. If another script on your page throws an error before the Maps script runs, the map will never initialize. This is especially common on sites with many plugins, custom scripts, or a theme that loads jQuery incorrectly.
Check Your API Key and Billing Status
The Google Maps JavaScript API requires a valid API key. If you are using a key that is restricted to certain domains and your current domain is not listed, the map will fail. To check this, log into the Google Cloud Console, go to "APIs & Services" and then "Credentials." Look at the key you are using and verify that the "Website restrictions" include your exact domain (including the https:// and www if applicable).
Billing is the second most common issue. Since 2018, Google requires a valid billing account linked to your Cloud project for the Maps API to work, even if you are within the free tier. If billing is not set up or the account has an issue, the API will return an error and the map will not load. Check the "Billing" section in the Cloud Console to ensure it is active and has no outstanding issues.
Verify the API Libraries Are Enabled
The Maps JavaScript API is not a single service; it has several separate libraries that you must explicitly enable. The core Maps JavaScript API is one, but if you are using features like markers with info windows, you may also need the Places API or the Geocoding API. If your code calls a function from a library that is not enabled, the map will fail to load.
In the Google Cloud Console, go to "APIs & Services" and then "Library." Search for the following and ensure they are enabled:
- Maps JavaScript API
- Geocoding API (if you convert addresses to coordinates)
- Places API (if you use autocomplete or place details)
If you are unsure which ones you need, start with just the Maps JavaScript API and add others only if your code explicitly uses them.
Look for JavaScript Errors in the Browser Console
The browser's developer console is your best diagnostic tool. Open your page, then press F12 (or right-click and select "Inspect"). Click on the "Console" tab. Look for any red error messages. Common ones include:
InvalidKey– The API key is wrong or restricted.RefererNotAllowedMapError– The domain is not in the key's allowed list.ApiNotActivatedMapError– The API library is not enabled.BillingNotEnabledMapError– Billing is not set up.
If you see a different error, read the full message. It often points to the exact line of code that is failing. If the console shows no errors but the map is still blank, the issue is likely a timing problem where the map is initialized before the page is fully ready.
Fix Theme and Plugin Conflicts
If you are using WordPress or another CMS, a theme or plugin conflict is a very likely culprit. To test this, temporarily switch your theme to a default one (like Twenty Twenty-Four) and see if the map loads. If it does, the issue is in your theme's code. If it still fails, deactivate all plugins one by one, refreshing the page each time, until the map appears. This isolates the conflicting plugin.
A specific conflict often occurs with caching plugins. They may minify or combine JavaScript files in a way that breaks the Maps script. Clear your caching plugin's cache, and if the problem persists, exclude the Google Maps script from minification or deferral settings.
How to Embed a Map Without an API Key
If you do not need custom markers or interactive controls beyond what a standard map offers, you can use the simpler Google Maps Embed API. This does not require a JavaScript key, only a free API key, and it works by simply putting an iframe in your HTML. The embed URL looks like this:
https://www.google.com/maps/embed?pb=YOUR_STRING
You can get this string by going to Google Maps, searching for a location, clicking "Share," then "Embed a map," and copying the iframe code. This method is far less prone to loading errors because it does not run any custom JavaScript on your page. It is the recommended solution for a simple store locator or contact page map.
Frequently Asked Questions
Why does Google Maps show a gray box instead of the map?
A gray box usually means the API request was made but the map failed to initialize. This is commonly due to an API key restriction mismatch or a JavaScript error occurring before the map's init function runs. Check the console for errors and verify that your key's allowed referrers exactly match your site's URL.
Does Google Maps cost money to use on my website?
Google Maps Platform offers a free tier for the JavaScript API, but you must link a billing account. The free tier includes a certain number of map loads per month; beyond that, you are charged per load. The Embed API (using the iframe) also requires a key but has a much higher free limit and is generally cheaper for simple use cases.
Can I use Google Maps without an API key at all?
No, you cannot use the JavaScript API without a key. However, you can use a static map image without a key by using a simple img tag with a Google Maps Static API URL, though this also technically requires a key for production use. The only truly keyless option is copying an iframe from the Google Maps share menu, which is not officially supported for commercial sites but works for basic embedding.
Why does the map work on my local computer but not on my live site?
This is almost always a referrer restriction issue. Your API key is likely restricted to localhost or a specific domain. When you deploy to your live site, the referrer changes, and the key no longer matches. Add your live domain to the key's allowed referrers in the Cloud Console.
What is the difference between "This page can't load Google Maps correctly" and a blank white area?
The "can't load" message is a specific error thrown by the Maps JavaScript API when it detects a configuration problem. A blank white area usually means the map container has a height of zero or the script never loaded at all. Check your CSS to ensure the map div has a defined height, such as height: 400px;.
How do I clear the browser cache to fix map loading issues?
Sometimes an old cached version of your page or the Maps script causes issues. Press Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac) to do a hard refresh, which bypasses the cache. If that works, the issue is likely a stale cache, and you should also clear your site's server-side cache if you use a caching plugin.