Maps and location · Library

Leaflet

A small, free JavaScript library for interactive maps on websites. It draws the map from tiles you choose, most often ones based on OpenStreetMap.

Map providers · Open source · updated

How it works

Leaflet handles the essentials: panning and zooming, markers, popups, lines, polygons and GeoJSON layers, on desktop and touch screens. It fetches square image tiles from whichever tile server you name, so it has no map data or account of its own. Hundreds of plugins add marker clustering, heatmaps, drawing tools, search boxes and routing, and react-leaflet wraps it for React apps.

It is deliberately simple and weighs only a few dozen kilobytes. The trade-off is that it mainly shows raster tiles without WebGL, so smooth rotation, 3D and restyling a vector map in the browser are out of reach without plugins; MapLibre GL JS is the open-source option for those. The tiles are the part that can cost money: the public OpenStreetMap servers are for light use only, so production sites usually use a tile provider such as MapTiler, Stadia Maps or Thunderforest, or serve their own.

Leaflet pros and cons

Pros

  • Free and open source, with no account or key for the library
  • Small, quick to load and simple to learn
  • Works with any tile provider, so switching is a one-line change
  • Large plugin ecosystem for clustering, drawing and heatmaps

Cons

  • No built-in search, geocoding or directions
  • Raster tiles cannot be restyled in the browser like vector maps
  • No 3D, tilt or smooth rotation out of the box

When to use Leaflet

Pick it when

  • A store locator, delivery area or contact-page map
  • Budgets that rule out per-load map fees
  • Showing GeoJSON data, such as zones or routes, on a simple map

Skip it when

  • Native mobile apps, which need a native map SDK
  • Vector styling, 3D or very large datasets (look at MapLibre or Mapbox)

Leaflet pricing

Open source

Free (BSD 2-Clause). Tiles come from a separate provider, which may charge for heavier use.

Approximate, checked September 2026.What the other tools cost

Leaflet vs the alternatives

More in Maps and location

Map providers

All 9 Maps and location terms

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.