Leaflet Online Compiler

About the Leaflet compiler

Interactive maps library. Runs in your browser. Run Leaflet code in your browser with no install and no signup — the editor, the input and the output share one screen. Leaflet compiles and runs on your own device through WebAssembly, so once the page has loaded it keeps working without a network connection.

Press Run to execute the program, edit it and press Run again, or paste your own code over it. Everything you type stays in the page; the editor caches your work locally so a reload does not lose it.

A Leaflet example

This is the program the Leaflet editor opens with — run it as it is, then change it.

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
  <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
  <style>body { margin: 0; } #map { height: 100vh; }</style>
</head>
<body>
  <div id="map"></div>
  <script>
    const map = L.map('map').setView([51.505, -0.09], 13);
    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
      attribution: '&copy; OpenStreetMap'
    }).addTo(map);
    L.marker([51.5, -0.09]).addTo(map).bindPopup('Hello from Leaflet!').openPopup();
  </script>
</body>
</html>

More Web UI Frameworks compilers

Browse all 109 languages — the same editor runs each of them, in the browser or on a shared runner.