An MBTiles file is an SQLite 3 database with the tables below. This page follows the MBTiles specification 1.3 from Mapbox, read 2026-11-12. It says a file may set SQLite’s application ID to the officially assigned magic number; the value is not given in the specification.
metadata table
Two text columns, name and value: one row per key.
| Key | Need | Value |
|---|---|---|
name | must | Name of the tile set. |
format | must | pbf (gzip-compressed Mapbox Vector Tiles), jpg, png, webp, or an IETF media type for other formats. |
bounds | should | left,bottom,right,top in WGS 84 degrees. |
center | should | longitude,latitude,zoom: the default view. |
minzoom, maxzoom | should | Lowest and highest zoom levels present. |
attribution | may | HTML attribution text. |
description | may | Text. |
type | may | overlay or baselayer. |
version | may | A revision of the tile set itself (not of the specification), as a number. |
json | must for pbf | A JSON object with vector_layers and optionally tilestats. |
Each entry of vector_layers has id (the layer name in the
tiles), fields (an object from attribute name to type:
Number, Boolean or String), and optionally
description, minzoom and maxzoom. Other keys may
be added freely.
Rules from the specification (the key words are RFC 2119): all text columns MUST be UTF-8. Tilesets are
SQLite databases of version 3.0.0 or higher using only core features (no extensions). The metadata table or view
MUST give exactly two text columns, name and value. bounds must define an area covered by all
zoom levels, in the OpenLayers order (left, bottom, right, top); the specification’s examples are the whole Earth without the
poles (-180.0,-85,180,85) and center -122.1906,37.7599,11. The json row, when
present, MUST be the UTF-8 text of a JSON object that MUST contain vector_layers. In each layer id and
fields are required (id is the layer name of the Mapbox Vector Tile specification), each field type MUST be
"Number", "Boolean" or "String", and attributes whose type varies between features SHOULD be listed
as "String". A layer’s minzoom MUST NOT be lower than the tileset’s and its maxzoom MUST NOT be
higher; they describe layers that appear only at some zoom levels (a “minor roads” layer at high zooms). Views that give the same
results MAY replace tables, which means one implementation may not be able to add to a file made by another. The informative
section also warns that relying on undefined metadata keys can cause compatibility problems.
tilestats
The json object MAY also hold tilestats, “an object in the geostats format” documented in the
mapbox-geostats repository (not read here). Like vector_layers it lists layers and attributes, but also sample
values and the range of numeric attributes. The structure as the specification’s example shows it:
"tilestats": {
"layerCount": 2,
"layers": [
{ "layer": "tl_2016_us_county", "count": 3233, "geometry": "Polygon", "attributeCount": 5,
"attributes": [
{ "attribute": "ALAND", "count": 6, "type": "number",
"values": [1000508839, 1001065264, …], "min": 82093, "max": 376825063576 },
{ "attribute": "GEOID", "count": 6, "type": "string", "values": ["01001", "01003", …] }
] }
] }
That is: layerCount; per layer layer (name), count (features), geometry
(Polygon, LineString, …), attributeCount and attributes; per attribute
attribute (name), count (number of sample values given), type (lower case
number or string in the example, unlike the capitalised types of vector_layers), values
and, for numbers, min and max. The specification’s full example is a TIGER 2016 tileset:
name “TIGER 2016”, format pbf, bounds
-179.231086,-14.601813,179.859681,71.441059, center -84.375000,36.466030,5,
minzoom 0, maxzoom 5, attribution “United States Census”, type overlay and
version 2.
Future directions (from the specification)
- A later revision will add a
compressionrow to themetadatatable for the compression of tile data, if any. - A later revision will make
bounds,minzoomandmaxzoommandatory. - A later revision will delegate the description of the
jsonrow to an external specification.
tiles table or view
| Column | Type | Meaning |
|---|---|---|
zoom_level | integer | Zoom, 0 for the whole world in one tile. |
tile_column | integer | Column, from 0 at the west edge. |
tile_row | integer | Row in the TMS scheme: 0 at the south edge. |
tile_data | blob | The tile image or vector tile. |
Tiles use the global-mercator (spherical Mercator) tile profile, with rows in the
TMS scheme, numbered from the south: for a web map (XYZ) row y counted
from the north, tile_row = 2zoom − 1 − y. A file may have a
unique index on zoom, column and row, and may use SQLite views that give the same
results instead of plain tables.
UTFGrid tables
Optional, for interactive raster maps:
grids:zoom_level,tile_column,tile_row,grid(a gzip-compressed UTFGrid JSON blob).grid_data:zoom_level,tile_column,tile_row,key_name,key_json(JSON for each key in the grid).