How to Embed a Google Map on Your Website

To embed a Google Map, open the place in Google Maps, choose Share, then Embed a map, and copy the HTML. Paste it where the map should appear. For a better result, wrap the iframe so it resizes on phones, add loading="lazy", and consider a click-to-load version so Google is only contacted when a visitor asks for the map.

Three ways to get the embed code
WayAPI keyNotes
Share, Embed a map in Google MapsNoOfficial and simplest; copy the iframe it gives you
Maps Embed API (place mode)Yes, restricted to your siteOfficial, configurable by address or place, listed by Google at no charge
q= address URL with output=embedNoCommon and convenient but not documented by Google, so it could change

Updated

The generator below writes the code for you from an address, from your own Maps Embed API key, or from the code Google gives you. It always adds a responsive wrapper and a title, and can wrap the map in a click-to-load button.

Google Map embed code generator

Type an address or paste Google's embed code to get a responsive iframe, with an optional click-to-load version.

Responsive wrapper for code copied from Google

If you already copied Google's iframe, paste it inside this wrapper and delete its width, height and style attributes.

Responsive, lazy map wrapper

The box keeps a 4 by 3 shape at any width. Replace the src with the one from your copied code.

<div class="map-embed">
  <iframe
    src="https://www.google.com/maps/embed?pb=PASTE_YOUR_CODE_HERE"
    title="Map showing our shop"
    loading="lazy"
    referrerpolicy="no-referrer-when-downgrade"
    allowfullscreen></iframe>
</div>
<style>
  .map-embed { position: relative; aspect-ratio: 4 / 3; width: 100%; border-radius: 12px; overflow: hidden; }
  .map-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
</style>

Responsive and lazy by default

A map iframe is a whole web app loading inside your page. loading="lazy" tells the browser to wait until the visitor scrolls near it, which speeds up the first view for everyone who never scrolls that far.

The CSS aspect-ratio property keeps the map's shape at any width, so you no longer need the old padding-bottom trick. 4 by 3 suits phones well; 16 by 9 suits wide desktop layouts.

Click to load

The click-to-load version shows a light placeholder with a button. Only when someone presses it does the page create the iframe and contact Google. It is faster and kinder to privacy, and the link under it still opens the full map for anyone who prefers the app.

How it works

  1. On a computer, open Google Maps and search for your business or address.
  2. Click Share, then the Embed a map tab, pick a size and click Copy HTML.
  3. Paste the code into the generator below, or simply type your address, and choose the shape and options.
  4. Copy the result into your site's HTML block or page template.
  5. Check it on a phone. The map should fill the width without spilling sideways.

Tips

  • Write the address as text next to the map too. Screen readers, search engines and people with slow connections all rely on it.
  • Give the iframe a title such as Map showing our shop on King Street. Without one, assistive technology announces it as an unnamed frame.
  • Do not put a map in the first screen of a page unless it is the point of the page. It is heavy and slows the first view.
  • If you serve several locations, embed one map per location page instead of one crowded map on the contact page.

Frequently asked questions

Is embedding Google Maps free?

Yes for the Share, Embed a map code. The Maps Embed API, which needs a key, is listed by Google as free to use. Other Maps products, such as the JavaScript map with custom markers, are billed by usage after a monthly free allowance, so check the current pricing before using them.

Why does my embedded map look tiny on phones?

The copied code sets a fixed width and height, such as 600 by 450 pixels. Remove those and wrap the iframe in a box that uses CSS aspect-ratio, like the generator's output, so it scales with the screen.

Does an embedded Google Map affect privacy or GDPR?

Loading the map sends the visitor's IP address and browser details to Google, and Google may set cookies. In places with strict consent rules, many sites show a placeholder with a Show map button and load the map only after that click, which is what the click-to-load option does. Mention the map in your privacy policy either way.

Can I embed directions or a custom map with several pins?

Directions: use the Directions tab in Google Maps before choosing Share, or the directions mode of the Maps Embed API. Several pins: create a map in Google My Maps, set it to public, then use its Embed on my site option.

Will an embedded map help my local SEO?

Not directly. What helps local search is a complete Google Business Profile and consistent name, address and phone number across the web. The map helps visitors find you, which is reason enough.

Related: HTML embed code generator, Service area map, How to get your business on Google, Contact us page examples, Privacy policy generator.

Build your site free or see all free tools. On We.Inc you can build your site free, with no card and no trial needed to start. AI building is on paid plans from $19 a month.

More in Guides

Product

Who It's For

Features

Resources

Company

View Sitemap