...

How to Put Google Maps on Your Website

Google Maps navigation shown on a smartphone screen

Adding Google Maps to your website is a great way to enhance user experience and provide location-based information. Whether you run a local business or want to guide visitors to your location, integrating a map is simple and effective. This guide will show you how to put Google Maps on your website step by step.

Step-by-step infographic: Add Google Maps to Your Website
The process at a glance

Why Add Google Maps to Your Website?

Improved User Experience

Google Maps helps users easily find your physical location, enhancing their experience with your site.

Increased Credibility

Displaying a map shows visitors that you are a legitimate business with a real address.

SEO Benefits

Having location-based content can boost your website’s local SEO ranking, making it more discoverable to nearby users.

Steps to Add Google Maps to Your Website

Here’s how to integrate Google Maps into your website quickly and efficiently.

Step 1: Find Your Location on Google Maps

  1. Open Google Maps.
  2. Search for the location you want to display on your website.
  3. Adjust the zoom level to fit your desired view.

Step 2: Generate the Embed Code

  1. Click on the three horizontal lines (menu) in the top-left corner.
  2. Select Share or embed map.
  3. Navigate to the Embed a map tab.
  4. Copy the provided HTML code.

Step 3: Add the Code to Your Website

For HTML Websites

  1. Open the HTML file of your website in a text editor.
  2. Paste the copied embed code in the desired section.
  3. Save your changes and upload the file to your server.

For WordPress Websites

  1. Go to your WordPress dashboard.
  2. Edit the page or post where you want to add the map.
  3. Switch to the Text or Code editor and paste the embed code.
  4. Save or update the page.

Customizing Your Google Map

Adjust Map Size

You can modify the width and height attributes in the embed code to fit your website’s design.

Add Markers

Use Google My Maps to create a custom map with additional markers and information. Embed this custom map instead.

Common Issues and Troubleshooting

Map Not Displaying Properly

Ensure your website supports iframes, as the embed code uses this technology.

Restricted Access

Check that the map’s sharing settings in Google Maps allow public access.


How to Put Google Maps on Your Website: Example Embed Code

After you choose Share and Embed a map in Google Maps, you receive an iframe like the example below. Replace the address with the one that Google gives you.

<iframe
  src="https://www.google.com/maps/embed?pb=YOUR_EMBED_CODE"
  width="600"
  height="450"
  style="border:0;"
  allowfullscreen=""
  loading="lazy"
  referrerpolicy="no-referrer-when-downgrade"
  title="Map showing our office location">
</iframe>

The loading="lazy" attribute delays the map until the visitor scrolls near it, which helps your page load faster. The title attribute describes the map for screen readers.

Make the Google Map Responsive

A fixed width can overflow on small screens. Wrap the iframe in a container and make it flexible.

.map-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 ratio */
  height: 0;
  overflow: hidden;
}

.map-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

Add Google Maps to a WordPress Website

In the block editor, add a Custom HTML block, paste the iframe, and preview the page. If you prefer a plugin, you can use a map plugin that offers markers and styling, and our guide on how to install a plugin on your WordPress website explains the process. Keep the number of plugins small, since each one adds code to your site.

Embed API, Share Embed, and the JavaScript API

MethodBest forNeeds an API key?
Share and embed from Google MapsA simple map of one locationNo
Maps Embed APIEmbedding maps in a controlled wayYes
Maps JavaScript APICustom maps with multiple markers and interactionsYes, and billing may apply

For a contact page with one address, the simple embed is usually enough. Check Google’s current pricing and terms before you use an API key on a busy website.

Privacy and Performance Tips for Embedded Maps

  • A map loads content from Google, so mention this in your privacy policy, and use a consent tool if your audience requires it.
  • Place the map below the main content, so that it does not slow the first screen.
  • Add a text address and a link to directions next to the map for people who cannot see it.
  • Test the page on mobile, since maps can capture scrolling gestures.

Frequently Asked Questions

Is it free to embed Google Maps?

A simple embed from the Share option is free. Using an API with a key may involve usage limits or charges, so review the current terms.

Alternatives to Embedding Google Maps

  • A static image of the map with a link to open Google Maps, which loads very fast and avoids third-party scripts.
  • A map from another provider, such as OpenStreetMap, if you prefer an open data source.
  • A simple text address with a Get directions button, which works well on mobile and is easy for everyone to use.

Choose the option that best matches your goals, your privacy requirements, and the speed of your website.

After you publish, test the map on several devices and browsers. Click the directions link, zoom in and out, and make sure that the marker shows the correct location. Update the map immediately if your business moves or changes its address.

Adding Google Maps to your website is a straightforward process, but it can get tricky if you’re not familiar with coding or platform-specific integrations.

If you find this guide too complex or time-consuming, let us help! Contact us today for professional assistance in adding Google Maps to your website, ensuring a seamless and visually appealing integration.

Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.