MapLibre GL JS

~210kb gzipped (core) -- up to ~750kb full

WebGL-powered vector maps with 3D pitch, smooth zoom, and runtime styling -- the open-source Mapbox GL fork.


01

See It in Action

Each demo loads vector tiles from OpenFreeMap (free, no API key) and shows what WebGL maps can do that Leaflet cannot: smooth zoom, 3D buildings, and animated camera tours.

A vector-tile map of Paris with a marker and popup. Scroll to zoom -- the continuous, label-rotating zoom is the WebGL difference vs. Leaflet's stepped raster tiles.

Preview

02

What is MapLibre GL JS?

MapLibre GL JS is a JavaScript library that renders interactive vector-tile maps in the browser using WebGL. Where raster libraries like Leaflet stitch together pre-rendered image tiles, MapLibre downloads vector geometry and draws it on a GPU canvas -- so zoom is continuous, labels stay crisp, and you can tilt and rotate the camera into 3D.

It started in December 2020 as a community fork of Mapbox GL JS v1.13 -- the last version released under the BSD license, before Mapbox switched to a paid proprietary license. Today the project is governed by an elected steering committee and incubated at the Linux Foundation, with sponsors that include Amazon, Meta, Microsoft, Esri, and StadiaMaps.

🚀
WebGL Vector Tiles
Vector tiles render on the GPU, so zoom is continuous and silky-smooth -- no stepped tile reloads. Labels rotate with the map and stay sharp at any zoom level.
🏙️
3D Buildings & Pitch
Tilt and rotate the camera to see 3D building extrusions, terrain, and atmospheric sky. Drag with right-click (or two fingers) to pitch -- a feature raster-tile libraries cannot do.
🎨
Runtime Style Spec
Maps are described in a JSON style spec. Change colors, fonts, layer visibility, or zoom-dependent paint properties at runtime with one method call -- no tile re-fetching.

03

When to Use MapLibre GL JS

Use when
Modern marketing maps with smooth fly-to camera animations
Brand-styled maps that match a product's design system
3D city visualizations and architectural tours
Real-time data dashboards plotting thousands of geo features
Travel sites with cinematic tour transitions between destinations
Avoid when
Simple 'show this address' maps -- Leaflet is lighter and simpler for static markers
Older browsers without WebGL support (IE11, low-end Android) -- Leaflet's raster tiles work everywhere
Quick prototypes where bundle size matters -- MapLibre is ~5x larger than Leaflet

04

How MapLibre GL JS Compares

MapLibre GL JS vs Leaflet

Leaflet is the lighter, simpler raster-tile choice -- great for store locators and 'show this on a map' use cases. MapLibre is the modern WebGL choice for vector tiles, smooth zoom, 3D, and runtime styling. Pick Leaflet for basic maps; pick MapLibre when you need vector styling, 3D, or smooth camera animation.

MapLibre GL JS wins at
Vector tiles, continuous smooth zoom, 3D terrain + buildings, runtime style changes, GPU rendering for 100k+ features, cinematic flyTo camera
Leaflet wins at
5x smaller bundle (~42kb vs ~210kb gzipped), zero deps, simpler API, works on older browsers without WebGL, faster initial parse
MapLibre GL JS vs Mapbox GL JS

Mapbox GL JS v2+ uses a proprietary license and bills per map load. MapLibre is a BSD-3-Clause hard-fork of Mapbox v1.13 (the last open release) and stays free forever. Same WebGL engine, similar API, no per-load billing.

MapLibre GL JS wins at
Free + open source license forever, no API key required, Linux Foundation governance (Amazon, Meta, Microsoft sponsors), self-hostable tile servers
Mapbox GL JS wins at
Polished default styles, Mapbox Studio for tile design, integrated geocoding + directions APIs, slightly more features in v3
MapLibre GL JS vs Google Maps Platform

Google Maps charges per map load after a small free tier and requires an API key on a billing account. MapLibre + free OpenFreeMap tiles costs zero forever. Pick Google Maps only if you specifically need Street View, Places, or branded Google tiles.

MapLibre GL JS wins at
Free with OpenFreeMap or self-hosted tiles, no API key, no vendor lock-in, fully open source, customizable style spec
Google Maps Platform wins at
Street View, Places autocomplete, integrated directions/traffic, better default styling, larger ecosystem of plugins
MapLibre GL JS vs OpenLayers

OpenLayers is the heavier, GIS-grade option supporting many projections, formats, and analysis features. MapLibre is the modern web-developer-friendly choice with cleaner API, smooth WebGL rendering, and a focused vector-tile pipeline. Pick OpenLayers for enterprise GIS; pick MapLibre for product UIs.

MapLibre GL JS wins at
WebGL vector rendering, smooth camera animation, modern style spec, smaller learning curve for web developers, friendlier API
OpenLayers wins at
More projections (EPSG codes), WMS/WMTS/WFS support, government data formats, deeper GIS analysis primitives

05

Get Started with MapLibre GL JS

Terminal
npm install maplibre-gl
Terminal
yarn add maplibre-gl
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/maplibre-gl.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/maplibre-gl.js"></script>
Quick Start
<!-- In your <head> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/maplibre-gl.css">

<!-- In your <body> -->
<div id="map" style="height: 400px;"></div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/maplibre-gl.js"></script>
<script>
  // MapLibre uses [longitude, latitude] -- NOT [lat, lng] like Leaflet.
  const map = new maplibregl.Map({
    container: "map",
    style: "https://tiles.openfreemap.org/styles/positron",
    center: [2.3522, 48.8566], // Paris
    zoom: 12
  });

  map.addControl(new maplibregl.NavigationControl());

  new maplibregl.Marker()
    .setLngLat([2.3522, 48.8566])
    .setPopup(new maplibregl.Popup().setHTML("Hello from Paris!"))
    .addTo(map);
</script>

06

Related Libraries