A map on your own page, centered on your place, with your marker, is one of the oldest asks on the web, and OpenStreetMap answers it without an API key, a billing account, or a sales call. The simplest answer is a snippet of HTML the map itself hands you. The fuller answers give you control over the view, the layer, and eventually the entire behavior of the map. This guide walks the ladder: the Share panel iframe for the five-minute job, the embed.html URL taken apart so you can build and fix embeds by hand, the static image option, and the library routes with Leaflet and MapLibre, closing with the usage policy that keeps free tiles free.
Home / GIS and Open Map Data for Beginners
Embed an OpenStreetMap Map: The Share Iframe, the embed.html URL, and the Library Routes

Photo: Djordje Petrovic / Pexels
Embed It Properly: The Map-on-Your-Site Checklist
Check off each step as you finish it. Your progress stays on this page.
0 of 7 complete
0% done
Route One: The Share Panel Iframe
On openstreetmap.org, frame the view you want to show (pan and zoom until the map on your screen is the map your readers should meet), then open the Share panel from the right-hand toolbar. Under the HTML option it offers a ready-made iframe snippet: copy it, paste it into your page, and the map appears, interactive, with pan and zoom, credited and linked as the license requires. Two adjustments are worth making in the panel before copying: add a marker at your location from the same panel if the map exists to show a place (an embedded map without a marker makes readers hunt for the point of it), and set the iframe's width and height in your own page's terms afterward, because the snippet's defaults are a starting size, not your layout's answer. This route is the right one for most sites, most of the time: a venue page, a club's meeting place, a trailhead in a trip report. It asks nothing of you but the paste, and it stays current because the map is served live, not screenshotted.
The embed.html URL, Taken Apart
The iframe's address is a small language worth learning, because it lets you build embeds in templates, fix embeds that framed the wrong valley, and generate them from data. The address is https://www.openstreetmap.org/export/embed.html, and its parameters do the work:
| Parameter | Meaning | Example shape |
|---|---|---|
| bbox | The view's edges: left, bottom, right, top longitude and latitude | bbox=13.38,52.51,13.43,52.53 |
| layer | The map style to show | layer=mapnik (the standard style); other public layers include cyclemap, transportmap, and hot |
| marker | A pin at a latitude, longitude | marker=52.5200,13.4050 |
Two habits follow. The bbox is the frame, not the center: the embed shows exactly the box you give it, stretched to your iframe's aspect, so a box whose proportions fight the iframe's will crop or pad in ways that surprise; choose the box for the frame it will live in. And the marker is independent of the box: nothing forces the pin inside the view, so check that your marker's coordinates actually fall within your bbox, because an embed framing one neighborhood with its pin in another is the classic generated-embed bug, invisible until a reader writes to ask where the place went. Understood this way, the Share panel stops being a vending machine and becomes a form you can fill in yourself, which is the difference between using an embed and depending on one.

Static Images: The Map as a Picture
Some homes for a map cannot run an interactive frame: an email, a PDF, a printed poster, a platform that strips iframes. The Share panel also offers the map as a static image in the common raster formats, at the view you framed, downloadable and self-contained. The trade is explicit: a static image never breaks, never needs the tile servers, and never updates; the trail rerouted last month stays wrong on it forever, and it cannot be zoomed by a reader standing in the rain. Use static for documents and print, where interactivity is impossible anyway, and treat its date as part of its honesty: a static map in a living document should be re-exported when the document is revised. For everything on the live web, the iframe or a library is the better citizen.
Route Two: A Library, Leaflet or MapLibre
When the map must behave like part of your site, responding to your data, styling itself to your design, clustering a thousand markers, drawing the route your application computed, an iframe is no longer enough and you graduate to a JavaScript mapping library. Leaflet is the classic lightweight choice: a small library that puts an OSM-based map on a page in a few lines, with layers, markers, pop-ups, and a plugin ecosystem for everything else; it works in raster tiles by default and is the route our uMap article's embeds gesture at from the no-code side. MapLibre GL JS is the modern vector route: GPU-rendered vector tiles with a style document, the system our vector tiles guide explains, for maps that must rotate, restyle, and animate. The choice between them is the raster against vector choice in miniature: Leaflet for simplicity and universal device support, MapLibre for interaction and style control. Both consume OpenStreetMap data under the same attribution duty, and both free you from the iframe's fixed frame: the map becomes a component, with your code in charge of what it shows.
Attribution: The Non-Negotiable Line
Every route in this article carries the same duty, and it is a license condition, not a courtesy: OpenStreetMap data is published under the Open Database License, and its standard terms for maps require visible credit, © OpenStreetMap contributors, with a link back, wherever the map appears. The Share iframe includes the credit automatically, which is one more reason it is the safe default. Library maps must add it deliberately (Leaflet and MapLibre both have an attribution control; switch it on and leave it on). Removing or hiding the credit is the one embed mistake with legal rather than merely technical consequences, and it is also simply the deal: a map drawn by millions of volunteers asks one line of text in return. Our attribution guide covers the forms the credit takes across media.
The Tile Usage Policy Caveat: Heavy Sites Must Serve Their Own
The last lesson is about scale, and it protects the whole system. The tiles behind the standard embed are served by the OpenStreetMap Foundation's servers, run on donated resources for the project's own map and for modest community use. The tile usage policy is explicit that heavy or commercial-scale use does not belong on those servers: if your site serves real traffic, or an app embeds the map for a large audience, you must switch to a commercial tile provider, a hosted plan, or your own tile infrastructure, which our tile server guide explains how to run. The policy is enforced, and tiles can be throttled or blocked for abuse. Read this as the ecosystem's honesty rather than its fine print: the free embed is a gift sized for the small web, and the moment your map succeeds beyond that size, the grown-up move is to pay for tiles or pour your own. Every serious OSM-based product made that move; making it on time is part of building on this map respectfully.
Responsive Embeds: Making the Iframe Behave on Phones
The snippet the Share panel gives you carries a fixed pixel size, and a fixed 600-pixel map is a broken layout on a 380-pixel phone. The standard cure is a wrapper: place the iframe inside a container styled with a proportional height (the padding-top aspect-ratio technique, or the modern CSS aspect-ratio property), set the iframe to fill the container absolutely with width and height at 100 percent, and the map scales with the page while keeping its proportions at every screen size. Remember the bbox lesson while doing this: the embed stretches the box you gave it to the frame it lands in, so a wide desktop box squeezed into a tall phone frame distorts the geography's apparent shape (the data is honest; the framing is not). Sites that care generate two embeds, a landscape box for wide frames and a squarer box for narrow ones, and switch with the same media queries that switch the layout. It is ten lines of CSS and one extra snippet, and it is the difference between an embed that looks installed and one that looks pasted.
Generating Embeds From Data
Once the URL is understood, embeds become generatable, which is where they turn from a convenience into infrastructure. A directory site with four hundred location pages does not visit the Share panel four hundred times; it stores each place's coordinates once and lets the template compose the embed address, bbox computed around the point at a chosen span, marker set to the point, layer chosen per page type. The discipline this demands is the one from the URL section, enforced by code instead of eyes: the generator must guarantee the marker falls inside the box (compute the box from the marker and it cannot fail), must escape the parameters correctly, and must choose spans appropriate to the place (a venue wants a neighborhood's span; a trailhead wants a valley's). Generated embeds also inherit the usage policy's arithmetic: four hundred pages of light traffic is still light, but a directory that succeeds becomes the heavy site the policy describes, and the migration to hosted or self-served tiles should be planned as a success milestone rather than discovered as a blockage. Build the embed so the tile source is one template variable, and the grown-up move, when it comes, is an afternoon instead of a rewrite.
Related Guides
If this page answered part of the question, these GIS guides cover the rest of the same ground:
- OpenStreetMap uMap: Layers, Imports, and a Backup: The no-code custom map whose own embed snippet builds on this article's iframe.
- OpenStreetMap Vector Tiles: Data Tiles, Styles, and Client Rendering: What the MapLibre route renders, and why the style is separate.
- OpenStreetMap Tile Server: How the Classic Raster Stack Works: The infrastructure the usage policy asks heavy sites to run for themselves.
- OpenStreetMap Attribution: The Credit Line Done Right: The license duty every embed carries, in all its forms.
- QGIS Web Map: Export Your Project to a Self-Contained Web Map with qgis2web: The neighboring job: publishing your own QGIS project, not OSM itself, as a web map.
Frequently Asked Questions
How do I embed an OpenStreetMap map on my website?
Frame the view on openstreetmap.org, open the Share panel, and copy the HTML iframe snippet it generates. Paste it into your page. Add a marker from the same panel if the map shows a specific place, and adjust the iframe size to your layout.
What do the embed.html parameters mean?
The bbox parameter sets the view's edges as left, bottom, right, and top coordinates; layer chooses the map style, such as mapnik for the standard style; marker places a pin at a latitude and longitude. Make sure the marker falls inside the bbox, or readers will not see the place the map is about.
Should I use the iframe or a library like Leaflet?
Use the iframe for a simple, static-purpose embed: it is five minutes of work and stays current. Use Leaflet or MapLibre when the map must respond to your data or design: custom markers and pop-ups, your own layers, styling, or vector rendering. The library route is more code and far more control.
Do I have to credit OpenStreetMap on an embedded map?
Yes. The data is published under the Open Database License, and visible attribution, © OpenStreetMap contributors, is a condition of use. The Share iframe includes it automatically; library maps must enable their attribution control and leave it on.
Can my high-traffic site use the standard embed tiles?
Not at scale. The OpenStreetMap tile usage policy reserves the project's own tile servers for modest use; heavy or commercial traffic must use a commercial tile provider or self-hosted tiles. Tiles served in breach of the policy can be throttled or blocked.
Photo credits: Djordje Petrovic (Pexels); Lukas Blazek (Pexels). Photos are served from this site; follow the credit to the library page for the original.