HTML, CSS and JavaScript Playground

Type HTML, CSS and JavaScript in three boxes and see the page update as you type. console.log output, warnings and errors appear in a console under the preview. The code runs in a sandboxed frame inside your browser that cannot reach this site, your cookies or the internet, so you can paste a snippet from a tutorial and try it safely.

Ctrl + Enter in an editor
Result
Console

Press Run to start.

Your code runs in a locked-down frame in your browser: it cannot read this site, your cookies or other tabs, and it has no network access, so fetch() and external files are blocked. Nothing is uploaded or saved; download the .html to keep your work.

Features

  • Separate HTML, CSS and JavaScript editors with a live result

  • Console that shows console.log, info, warn and error, uncaught errors with line numbers, and alert() messages

  • Runs as you type, or turn that off and press Run (or Ctrl + Enter)

  • Tab key indents inside the editors

  • Download everything as one standalone .html file

  • Sandboxed: no access to this site, cookies or storage, and all network requests blocked

What people use the playground for

Trying a snippet from a tutorial

Paste the HTML, CSS and JS from a course or Stack Overflow answer and see what it does before adding it to your project.

Building a small widget

Work out a button, a card or a form layout on its own, then download the .html or copy each part into your site.

Teaching and practice

Students can experiment with tags, selectors and DOM events and see the effect instantly, on any laptop, with nothing to install.

Reproducing a bug

Cut a problem down to the smallest HTML, CSS and JS that shows it, which is what most forums and issue trackers ask for.

How the sandbox works

What your code can and cannot do

  • It runs in an iframe with the sandbox attribute set to scripts only, which gives it a separate, empty origin. It cannot read this page, your cookies, localStorage or other tabs.
  • A content security policy blocks every network request: fetch(), XMLHttpRequest, WebSocket, and external scripts, stylesheets, images and fonts. Images and fonts written as data: URLs work.
  • Pop-ups, form submissions and navigating the main page are blocked. alert(), confirm() and prompt() are shown in the console instead of as dialogs.
  • Because external files are blocked, libraries from a CDN (jQuery, Bootstrap, Tailwind) do not load here. Use plain HTML, CSS and JavaScript.

Saving your work

Nothing is stored on our servers and there are no share links. Use Download .html to save a single file with your HTML, CSS and JavaScript in it. That file has no sandbox, so it can load CDN libraries when you open it from your computer.

If the page stops responding

An endless loop such as while (true) {} can freeze the preview and sometimes the whole tab. Turn off "Run as I type" while writing loops, and reload the page if it hangs.

HTML, CSS and JavaScript Playground - FAQ