Home / GIS and Open Map Data for Beginners

OpenStreetMap Tile Server: How the Tiles You See Are Made, Cached, and Served

Server racks and network cables inside a data center

Photo: Brett Sayles / Pexels

Look closely at any web map and you can catch it thinking in squares. Pan fast and the world arrives in blocks; zoom and each block resolves into four more. Those blocks are tiles, the unit of work of every slippy map, and OpenStreetMap's tile system is the reference implementation the whole industry learned from. Understanding it matters to anyone who uses OSM in a product, teaches with it, or wonders why a free map asks heavy users to make their own. This guide takes the system apart in the order a request travels: the pyramid and its addressing scheme, the rendering stack that turns a planet-sized database into pictures, the caching that makes it survivable, and the usage policy that keeps a donated service alive. Our zoom levels guide covers what each level shows; this guide covers what each level costs.

Interactive tool

Serve the Pyramid: The Tile Server Checklist

Check off each step as you finish it. Your progress stays on this page.

0 of 7 complete

0% done

The Pyramid: z/x/y and the Arithmetic of Zoom

A tile is a square image, 256 by 256 pixels, covering a fixed patch of the earth. Every tile has an address of three numbers: z, the zoom level, and x and y, its column and row within that level's grid. The address becomes a URL in the form tile.openstreetmap.org/{z}/{x}/{y}.png, which means every map view you have ever opened was your browser fetching a shopping list of these addresses and assembling them into a seamless picture. The pyramid's arithmetic is the single most important fact in tile economics. At zoom 0, the entire world is 1 tile. Each deeper level splits every tile into four, so level z holds 2^z tiles per axis and 4^z tiles in total: 4 at zoom 1, 16 at zoom 2, and by zoom 10, 1,048,576 tiles for the full planet. Nobody stores the whole pyramid at deep zooms, and the reason is this multiplication: each additional level quadruples the work, so the deep levels, street by street, exist in serious numbers only where people actually look. A tile server is, at heart, a machine for deciding which of those tiles to draw, when to draw them, and how long to keep them.

The Rendering Stack: From Database to Picture

A tile begins as data. OpenStreetMap's database holds the planet as nodes, ways, and relations; a rendering database, typically PostgreSQL with PostGIS, holds an imported, flattened copy optimized for drawing. When a tile is requested and no fresh cached copy exists, the request reaches the rendering machinery: renderd, the daemon that queues and prioritizes render jobs, driving Mapnik, the rendering library that applies a stylesheet, the cartography, which colors, widths, labels, and icons each feature earns at this zoom, to the data for that tile's patch of earth. Tiles are rendered in metatiles, blocks of 8 by 8 tiles drawn in one pass and then sliced, because rendering a neighborhood at once is far more efficient than rendering 64 squares separately, and because labels crossing tile edges need to see their neighbors to be placed well. The stylesheet is where the map's personality lives: the standard OSM style that makes motorways orange and forests green is one stylesheet among many, and our basemaps guide shows how the same database wears entirely different faces under different styles. Change the stylesheet and the same server serves a cycling map, a humanitarian map, a monochrome planning map, all from one database.

Server racks and network cables inside a data center
Server racks and network cables inside a data center

Caching: The Only Reason Any of This Survives

Rendering is expensive and reading is cheap, so a tile server's real architecture is a memory. Rendered tiles are stored on disk and served from that store for every subsequent request, with mod_tile, the Apache module in the classic stack, deciding per request whether the cached tile is fresh enough to serve, stale but servable while a re-render queues, or missing and worth rendering now. In front of the server, further caches, CDNs and regional tile caches, absorb the popular geography: the tiles of famous cities at mid zooms are among the most requested small files on the internet, and they are served from cache essentially always. The deep logic of the system is that the map is mostly read and rarely redrawn, and redraws concentrate where edits happen and where eyes go. This is also why a fresh OpenStreetMap edit does not appear on the map instantly at every zoom: high zooms re-render quickly, low zooms, whose tiles each summarize continents of data, refresh on slower cycles. When you add a basemap in QGIS, the XYZ layer you configure is a client of exactly this system, asking a tile server for z/x/y addresses and assembling the answers.

The Public Tiles and the Usage Policy

The tiles at tile.openstreetmap.org are a donated service, run by the OpenStreetMap Foundation on donated hardware and bandwidth, primarily to serve the project's own map and its community of mappers. They are not a free commercial tile CDN, and the Tile Usage Policy says so in operational terms: heavy use, bulk downloading, and unattributed commercial traffic are prohibited, apps must identify themselves properly, and anyone whose product depends on tiles at scale is expected to run their own server or buy service from a tile provider. This is not stinginess; it is arithmetic from the pyramid section. A single popular app can request tiles faster than a charity's servers can render them, and every heavy user crowds out the mappers the service exists for. The policy is the reason the ecosystem has the shape it does: providers who render OSM data into tiles as a business, switch-on tile hosting for projects, and a long tradition of organizations running the open-source stack, PostgreSQL, renderd, mod_tile, Mapnik, for themselves. Respect the policy the way you would respect a public library's fair use: it is a commons, and commons survive on exactly this etiquette. The attribution guide covers the credit that must travel with the tiles wherever they are used.

Running Your Own: The Honest Menu

If your project outgrows the public tiles, the menu has three courses. Buy tiles from a provider: fastest, priced by volume, and the right answer for most products, since rendering infrastructure is a specialty like any other. Host the rendering stack yourself: the open-source components are free and documented, community packages and container images exist for the standard style, and the real costs are the ones this guide has been tallying: the planet import's disk and RAM, the storage for the zoom levels you pre-render, and the bandwidth your users generate. Pre-render only where your audience lives, in geography and in zoom, because the pyramid punishes completionism. Render on demand with vector tiles is the modern third path, serving data tiles that the client styles in the browser, powerful and a different architecture altogether. Whichever course you choose, the decision framework is the same one this guide opened with: count your tiles. Your zoom range, your geography, and your traffic multiply into a number, and that number, not enthusiasm, should choose your infrastructure. The map is free. The squares it travels in are engineering, and engineering has a budget.

The Ecosystem Around the Tiles

Step back from the machinery and the tile system resolves into an ecosystem with distinct inhabitants, and knowing who is who clarifies every decision in this guide. The OpenStreetMap Foundation's operations team runs the public tile service as one duty among many, on infrastructure the project's donors fund, and its users are the mappers first: the standard layer on openstreetmap.org exists so contributors can see their work. Regional and topical tile caches sit in front of or beside that service in various arrangements, absorbing load for their communities. Commercial providers render the same open data into tiles as a business, selling reliability, capacity, and styles the foundation never promised anyone. Self-hosters, from national mapping programs to small nonprofits, run the open stack for their own publics. And the clients, every web map, desktop GIS, and hiking app that speaks z/x/y, complete the circuit. The healthy reading of this ecosystem is that the free public tiles are the commons at its center, generous and finite, and the surrounding paid and self-run layers exist precisely so the commons does not have to carry the world's traffic. When a project of yours grows, migrating from the commons to one of the surrounding layers is not a betrayal of the open map. It is the open map's design working exactly as intended, and the attribution traveling with your tiles keeps the credit, and the data flowing back as edits, pointed the right way.

What a Tile Service Actually Spends

Running tiles costs two different currencies, and confusing them produces bad architecture. The first is rendering compute: drawing tiles from the database is the expensive act, paid in processor time, and it is paid once per unique tile per data refresh when caching works. The second is bandwidth: serving a cached tile is cheap per tile and relentless in aggregate, a popular map's millions of small answers adding up to the line item that surprises new operators. The cache sits between the two currencies and converts one to the other, spending a little disk to save a lot of both. This is why the operational questions of a tile service are economic before they are technical: which zooms to pre-render (spending compute early to make bandwidth cheap), how long rendered tiles stay fresh (freshness is bought with re-rendering), and which regions justify local infrastructure (bandwidth follows the audience's geography). It is also why the public OSM service's usage policy reads the way it does: the foundation's donors fund a finite pile of both currencies, and bulk downloading is simply spending the pile at a rate the pile cannot sustain. An operator who internalizes the two currencies can read any tile architecture, their own or a provider's pricing page, and see the real decisions underneath the diagrams.

Related Guides

Readers working through this topic usually need its closest companions too. These GIS and open data guides cover the neighboring ground:

Frequently Asked Questions

What is a tile server?

A system that serves map tiles: small square images, addressed by zoom and grid position as z/x/y, that web maps assemble into a seamless picture. OpenStreetMap's stack renders tiles from its database with Mapnik via renderd, caches them, and serves the cached files for nearly every request.

How many tiles are there at a given zoom level?

Zoom level z holds 4 to the power z tiles for the whole world: 1 at zoom 0, 4 at zoom 1, and 1,048,576 at zoom 10. Each deeper level quadruples the count, which is why deep zooms are only rendered where people actually look.

Can I use tile.openstreetmap.org in my app?

For light use that follows the Tile Usage Policy, with proper attribution and identification, the public tiles tolerate modest traffic. Heavy or commercial use is expected to run its own server or buy tiles from a provider; the public service is a donated resource for the mapping community.

Why does my OpenStreetMap edit not appear on the map immediately?

Tiles are cached. High zoom tiles re-render quickly after an edit, while low zoom tiles, which summarize large areas, refresh on slower cycles. The data is saved instantly; the pictures catch up on their own schedule.

What is a metatile?

A block of tiles, typically 8 by 8, rendered in one pass and then sliced into individual tiles. Rendering neighborhoods at once is more efficient and lets labels that cross tile edges be placed correctly.

Photo credits: Brett Sayles (Pexels); Christina Morillo (Pexels). Photos are served from this site; follow the credit to the library page for the original.