Mapsopenstreetmap.org

Can you embed OpenStreetMap in an iframe?

Yes, with the HTML code from the Share panel. The OpenStreetMap wiki documents the export/embed.html URL for iframes, not the main map page.

Checked Test again

Live check

Two links, two results

Result of
Map pagePartial
www.openstreetmap.org
X-Frame-Options
SAMEORIGIN (ignored)
CSP frame-ancestors
'self'
Response
200 OK · 393 ms · HTTPS
Embed URLEmbeddable
www.openstreetmap.org/export/embed.html?bbox=-0.1357%2C51.4974%2C-0.1157%2C51.5066&layer=mapnik
X-Frame-Options
Not sent
CSP frame-ancestors
Not sent
Response
200 OK · 358 ms · HTTPS

Steps

How to embed OpenStreetMap

  1. Open openstreetmap.org and move the map to the area you want.
  2. Click the Share button at the side of the map.
  3. To show a pin, select Include marker. Then move the marker.
  4. Under Link or HTML, clickHTML
  5. Copy the code from the Output box. It starts with <iframe>.
  6. Paste the code into the HTML of your page.

Embed code

Paste this into your page

HTML
<iframe
  width="425"
  height="350"
  src="https://www.openstreetmap.org/export/embed.html?bbox={west},{south},{east},{north}&amp;layer=mapnik&amp;marker={lat},{lon}"
  style="border: 1px solid black"
  title="{map title}">
</iframe>
<br/><small><a href="https://www.openstreetmap.org/#map={zoom}/{lat}/{lon}">View Larger Map</a></small>

Remove the marker parameter when you do not want a pin. The bbox sets the area that the map shows.

URL patterns

Swap the link you have for the embed URL

  • You havehttps://www.openstreetmap.org/#map={zoom}/{lat}/{lon}Use in the iframehttps://www.openstreetmap.org/export/embed.html?bbox={west},{south},{east},{north}&layer=mapnik

The Share panel makes the bbox from the map area that you see.

Good to know

  • The embed shows a map that visitors can move and zoom.
  • To show more than one marker, use your own map library.
  • Use OpenStreetMap data only as the OpenStreetMap license allows.

Sources

Profile updated

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.