D3.js Online Compiler

About the D3.js compiler

Data-driven document manipulation library. Runs in your browser. Run D3.js code in your browser with no install and no signup — the editor, the input and the output share one screen. D3.js 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 D3.js example

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

<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
  <style>body { font-family: sans-serif; padding: 2rem; } svg { margin: 1rem 0; }</style>
</head>
<body>
  <h1>D3.js Demo</h1>
  <div id="chart"></div>
  <script>
    const data = [30, 86, 168, 281, 303, 365];
    const width = 400, height = 200;
    const svg = d3.select('#chart').append('svg').attr('width', width).attr('height', height);
    svg.selectAll('rect')
      .data(data)
      .enter().append('rect')
      .attr('x', (d, i) => i * 70)
      .attr('y', d => height - d * 0.5)
      .attr('width', 50)
      .attr('height', d => d * 0.5)
      .attr('fill', '#6366f1')
      .attr('rx', 4);
  </script>
</body>

The editor opens with the full program.

More Web UI Frameworks compilers

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