Home / GIS and Open Map Data for Beginners

How to Add a Basemap in QGIS: XYZ Tiles in Two Minutes

Aerial view of a winding river cutting through green land

Photo: Vladimir Konoplev / Pexels

Open a new QGIS project and add your first shapefile, and it floats in a white void: correct, precise, and almost impossible to judge. Is this polygon where you think it is? Is the layer shifted, misprojected, upside down? A basemap answers all of that at a glance, which is why adding one is the first move of nearly every QGIS session, professional or first-ever. The good news is that QGIS expects this: the machinery for streamed tile basemaps is built in, the most popular service on earth is pre-registered, and the whole job takes about two minutes once you know which panel to open. This guide walks the built-in route, then the general one, any tile service by URL, then explains the one piece of theory, Web Mercator and on-the-fly reprojection, that makes the magic feel effortless, and closes with the etiquette that keeps free tile services free.

Interactive tool

A Live Service, Not a Picture: The QGIS Basemap Checklist

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

0 of 8 complete

0% done

The Built-In Route: XYZ Tiles in the Browser Panel

Look at the Browser panel, usually docked on the left of the QGIS window. Among its entries sits XYZ Tiles, the home of streamed tile connections. Expand it and you will find OpenStreetMap already listed, a connection QGIS ships ready-made. Double-click it, or drag it into the Layers panel, and the world map streams into your canvas as a layer named OpenStreetMap. That is the whole procedure, and it is worth pausing on what just happened: QGIS is not downloading a map file. It is requesting small map images, tiles, for exactly the area and zoom on your screen, from the tile server, and stitching them live as you pan and zoom. Zoom in and finer tiles replace coarser ones; the stream follows you. The basemap lands at the bottom of your layer stack if you drag it there, which is where a basemap belongs, beneath your data, and every layer you add from then on draws over real streets and real coastline. If the Browser panel is hidden, the View menu's Panels submenu brings it back. First-timers often meet QGIS through a guided path like our QGIS tutorial for beginners; this article assumes you are in the program with a project open and a void to fill.

Add Any Service: The URL Template

The built-in connection teaches the general pattern, because every XYZ service is just a URL with three placeholders. Right-click XYZ Tiles in the Browser and choose New Connection. Give it a name you will recognize, and paste a URL template in the form https://tile.openstreetmap.org/{z}/{x}/{y}.png, where {z} is the zoom level and {x} and {y} are the tile's column and row, numbers QGIS computes from your view and substitutes on every request. Set the minimum and maximum zoom the service supports, 0 and 19 for OpenStreetMap's standard tiles, and save. Your new connection now sits beside the built-in one, ready to double-click into any project. This single mechanism unlocks the whole world of tile services: satellite imagery providers, national mapping agencies, and the alternative OpenStreetMap styles, the cycling and humanitarian faces compared in our guide to OpenStreetMap basemaps, all publish XYZ templates you can add the same way. The QuickMapServices plugin, installable from QGIS's plugin manager, wraps this in a menu of ready-made services for those who would rather pick than paste, and it is the route most regular users end up taking. Either way, the concept to keep is the template: a basemap connection is an address pattern, not a file, and it stays live for the life of the project.

Aerial view of a river winding through farmland
Aerial view of a river winding through farmland

Why It Just Works: Web Mercator and On-the-Fly Reprojection

Tile services speak one projection almost without exception: Web Mercator, registered as EPSG:3857, the spherical Mercator variant the web map world standardized on. Your data, meanwhile, can live in any coordinate system at all, a national grid, a UTM zone, raw latitude and longitude. The reason the basemap aligns with your layers anyway is a QGIS behavior called on-the-fly reprojection: the project has a coordinate reference system, and QGIS reprojects every layer into it for display, silently and continuously. Add the OpenStreetMap basemap and QGIS typically sets or confirms the project in EPSG:3857, then bends your data to match for the screen, while the files on disk keep their native systems untouched. Two practical consequences follow. First, alignment problems between your data and the basemap are almost never the basemap's fault; they mean a layer's own CRS is missing or wrongly declared, a classic beginner fault with a known cure, telling QGIS the system the data was actually collected in. Our treatment of reprojecting a layer in QGIS covers the permanent version of that fix. Second, Web Mercator distorts: areas swell toward the poles, so never measure areas or trust shapes quantitatively off the basemap's projection. Use the basemap for context and position, and do your measuring in a projection chosen for the job.

The Etiquette: Attribution and Fair Use of Free Tiles

A streamed basemap is someone else's server answering your QGIS all day, and the arrangement has terms. OpenStreetMap's tile usage policy asks for visible attribution, the "© OpenStreetMap contributors" credit, which QGIS helps honor when you compose a printed map, and prohibits bulk downloading: scripting a harvest of tiles to build an offline copy is exactly what the policy exists to stop, and it can get an application blocked. Inside a desktop GIS session, ordinary interactive use, panning, zooming, composing, is the intended use and welcome. If your workflow needs tiles at production scale, or a truly offline basemap, the supported routes are to render your own from OpenStreetMap data or to contract with a tile provider, the same bargain the wider ecosystem runs on. There is also a craft point hiding in the etiquette: a basemap is a reference, not a result. Keep it visually quiet under your data, lower its prominence if the style allows, cite it in layouts, and let your own layers carry the argument of the map. The basemap's job is to make your data legible; the moment it upstages the data, the map has two subjects and therefore none.

Troubleshooting: The Three Failures Everyone Meets

The basemap does not appear. Work the chain in order: is the XYZ layer actually in the Layers panel and ticked visible, is it buried under an opaque layer of your own (drag it down the stack), and is the machine online, since a streamed basemap is a network product wearing a layer's clothes. A layer that drew yesterday and not today is usually a network or a service hiccup, and the test is a fresh project with the built-in connection. The basemap appears but your data floats in the wrong place. That is the CRS fault from the previous section wearing its commonest disguise: your layer's coordinates are being interpreted as a different system than they were collected in. The cure is to declare the layer's true CRS in its properties, not to drag the data by eye, and never to "fix" it by editing coordinates to match the picture. The basemap is blurry or stops refining as you zoom. You have passed the service's maximum zoom, 19 for OpenStreetMap's standard tiles, and the client is stretching the deepest tiles it has. Every tile service has a floor of detail; beyond it, the honest instruments are your own data and a larger-scale source, and the blur is the service declining to invent detail it does not hold. Each of these failures teaches the same lesson from a different side: a basemap is a live service with limits and terms, not a picture pasted into your project, and working with it well means knowing which of its behaviors you are looking at.

Basemaps and Scale: Why the Reference Layer Changes as You Zoom

A subtle behavior of streamed basemaps rewards understanding: the reference map is not one map but a stack of generalizations, a different drawing at every zoom. Zoomed out, the service shows a cartographer's summary, major roads, big rivers, city dots; each step closer swaps in a drawing with more of the world admitted, until at street zooms the full local detail appears. This is why the same basemap can feel simultaneously too empty and too crowded in one session: at a regional zoom it is hiding the lane your data describes, and at a street zoom it is labeling features your analysis does not care about. Two working habits follow. Judge your layer stack at the zoom your audience will actually use, and set layer visibility ranges with that audience in mind, because a composition that sings at one scale can mislead at another. And when a basemap seems to contradict your data, check the zoom before you doubt either one: at the wrong scale the basemap is not lying, it is summarizing, and your data's job is to be the detail layer that the summary makes room for. Cartographers have managed this for centuries on paper, where one atlas held maps at many scales between the same covers. The tile pyramid is that atlas, automated, and the professional skill is the same as it ever was: know which scale you are reading.

Related Guides

This guide does not stand alone. The GIS and open map data guides below take up the questions it leads into:

Frequently Asked Questions

How do I add OpenStreetMap as a basemap in QGIS?

Open the Browser panel, expand XYZ Tiles, and double-click the OpenStreetMap connection QGIS ships with. The map streams into your canvas as a layer; drag it to the bottom of the layer stack so your data draws on top.

What is an XYZ tile URL?

It is a template address for a tile server, in the form https://tile.openstreetmap.org/{z}/{x}/{y}.png. QGIS substitutes the zoom level and the tile column and row for your current view and requests exactly the tiles your screen needs.

Why does my data line up with the basemap even in a different projection?

QGIS reprojects layers on the fly into the project's coordinate reference system for display. Tile basemaps use Web Mercator (EPSG:3857), and QGIS bends your layers to match on screen without altering the files. If a layer misaligns, its own declared CRS is usually wrong or missing.

Is there a plugin that adds many basemaps at once?

Yes. QuickMapServices, installed from the QGIS plugin manager, provides a menu of ready-made basemap services, including several OpenStreetMap styles and imagery providers, without pasting URL templates by hand.

Can I download tiles for offline use?

Not by harvesting the public tile servers; the OpenStreetMap tile usage policy prohibits bulk downloading. For offline basemaps, render your own tiles from OpenStreetMap data or use a provider whose terms allow offline use, and always keep the attribution credit visible.

Photo credits: Vladimir Konoplev (Pexels); Radoslaw Sikorski (Pexels). Photos are served from this site; follow the credit to the library page for the original.