Three.js Online Compiler

About the Three.js compiler

3D graphics library for the web. Runs in your browser. Run Three.js code in your browser with no install and no signup — the editor, the input and the output share one screen. Three.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 Three.js example

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

<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/build/three.min.js"></script>
  <style>body { margin: 0; overflow: hidden; }</style>
</head>
<body>
  <script>
    const scene = new THREE.Scene();
    const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
    const renderer = new THREE.WebGLRenderer({ antialias: true });
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);
    const geometry = new THREE.BoxGeometry(1, 1, 1);
    const material = new THREE.MeshNormalMaterial();
    const cube = new THREE.Mesh(geometry, material);
    scene.add(cube);
    camera.position.z = 2.5;
    function animate() {
      requestAnimationFrame(animate);
      cube.rotation.x += 0.01;
      cube.rotation.y += 0.01;
      renderer.render(scene, camera);
    }

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.