Slippy Map Tile Coordinate

Convert between lat/lng and slippy map tile X/Y/Z.

Open tool

Overview

The Slippy Map Tile Coordinate converter translates between latitude/longitude and the X/Y/Z tile coordinates used by online slippy maps. Drop in a coordinate and a zoom level and the tool returns the tile that contains it, along with the tile's bounding box and the URL pattern used by OpenStreetMap-style tile servers. The reverse direction also works: type X/Y/Z and the tool returns the lat/lng bounds of that tile.

Slippy maps - the draggable, zoomable tile-based maps used by OpenStreetMap, Google Maps, Mapbox, Bing Maps and pretty much every modern web mapping library - all share the same tile addressing scheme. Each tile is a 256 by 256 pixel image identified by three integers: a zoom level Z (0 for the whole world, 19 for individual buildings) plus X (column) and Y (row) coordinates within that zoom. Knowing how lat/lng map to X/Y/Z is essential when debugging map layers, building a tile cache or stitching tiles into a static image.

How it works

The tile scheme uses the Web Mercator projection (EPSG:3857). At zoom level Z, the world is divided into 2^Z columns and 2^Z rows of tiles. To convert lat/lng to X/Y at zoom Z, longitude maps linearly: X = floor((lng + 180) / 360 · 2^Z). Latitude maps through the Mercator equation: Y = floor((1 − ln(tan(φ) + sec(φ)) / π) / 2 · 2^Z). The Y axis runs top-to-bottom (north to south) by convention - tile (0, 0) is in the top-left of the world map.

Decoding inverts the math: given X, Y, Z, the tool computes the lat/lng of the tile's NW corner and SE corner, which gives the bounding box. The centre coordinate is the average of those corners in lat/lng space.

Examples

  • (51.5074, -0.1278) at zoom 12 maps to tile (2046, 1361, 12) - central London.
  • (40.7128, -74.0060) at zoom 10 maps to tile (301, 385, 10) - New York City.
  • Tile (0, 0, 0) covers the entire world from (-85.05, -180) to (85.05, 180).
  • Tile (524288, 348160, 19) covers a roughly 30 cm patch in central London.

FAQ

Why does the map cut off near the poles?
Web Mercator becomes infinitely tall as latitude approaches ±90 degrees, so slippy maps cap the projection at roughly ±85.05 degrees latitude (atan(sinh(π))). Anything north or south of that band is not displayable in the standard tile scheme.

What is TMS and how is it different?
TMS (Tile Map Service) is a similar scheme that uses the opposite Y axis convention: Y = 0 is at the bottom (south) instead of the top (north). The tool uses the more common XYZ scheme as used by OSM and Google. To convert XYZ Y to TMS Y at zoom Z, use tms_y = 2^Z - 1 - xyz_y.

How big is a tile in metres?
At zoom Z, one tile is roughly 40075016.686 · cos(latitude) / 2^Z metres wide. At the equator, zoom 0 is the whole world, zoom 10 is roughly 39 km wide, and zoom 18 is about 153 m wide.

Where do tile servers get the imagery?
Each provider renders or pre-renders its own tile imagery. The XYZ URL pattern is just the addressing scheme; the actual pixels come from OSM, Mapbox, Stadia, Esri or whichever provider you configure.

Try Slippy Map Tile Coordinate

An unhandled error has occurred. Reload ×