Developer tool

HTML CSS JavaScript Playground

Write HTML, CSS and JavaScript, then press Run to see a local preview.

Runs in your browser. No upload.

Values are processed locally in this browser.

Result

—

About this tool

HTML CSS JavaScript Playground made simple.

Code runs only after you press Run inside a sandboxed iframe. The preview has no same-origin access and cannot access this page’s storage.

Guide

Using HTML CSS JavaScript Playground

The HTML CSS JavaScript Playground lets you type a small page in three boxes and see it run in a preview frame on the same screen. You write the HTML, the CSS and the JavaScript, press the main button, and the code runs inside a sandboxed frame that is cut off from this page. It is for quick experiments, not for building or hosting a real project.

How to use it

  1. Type your markup in the HTML box, your styles in the CSS box and your script in the JavaScript box. You do not need all three, and you do not need to write the html, head or body tags.
  2. Press the main button under the boxes. Its label reads Calculate, although the page text calls it Run. The code runs only after you press it, not while you type.
  3. Look at the preview frame in the Result area. It shows your page after the CSS was applied and the script ran.
  4. Edit the boxes and press the button again to refresh the preview. Clear empties the three boxes, so copy anything you want to keep first.

Worked examples

A heading, a style and a script

You enter
Html
<h1 id="t">Hello</h1><p id="o">waiting</p>
Css
h1{color:crimson}
Javascript
document.getElementById("o").textContent="JS ran"
You get
Preview
A crimson Hello heading, and the second line reads JS ran instead of waiting

The CSS colors the heading crimson and the script replaces the text of the second line. This was run in the live page and the preview showed both changes.

Run through the tool’s own code.

Storage and network are blocked

You enter
Javascript
fetch("https://example.com"); localStorage.setItem("a","1")
You get
Fetch
blocked
Local storage
blocked

In a test run, both calls failed inside the frame. The frame has no same-origin access, and its content policy blocks all network requests. Your script cannot reach the page's storage or the web.

Run through the tool’s own code.

A remote image does not load

You enter
Html
<img src="https://example.com/x.png" alt="remote image">
Javascript
alert("hi")
You get
Image
shows only its alt text
Alert
no pop-up appears, and the script carries on

The frame allows only images given as data: or blob: addresses, so a web address fails and the alt text shows. The alert call does not stop the script, and no dialog appears. This was tried in the live page.

Run through the tool’s own code.

When it helps

  • Test how a few lines of CSS change a small block of HTML.
  • Try a short JavaScript idea that changes the page, such as updating text or toggling a class.
  • Show a beginner what a simple page looks like without setting up a project.
  • Reproduce a small layout problem in isolation before asking someone for help.

Limits to keep in mind

  • The preview runs in a sandboxed frame that can run scripts but has no same-origin access. Your code cannot read this page's storage, cookies or data.
  • The frame cannot load anything from the web, whether scripts, styles, fonts, fetch calls or images. Only inline code and images given as data: or blob: addresses work.
  • Each box is cut off at 100,000 characters when the preview is built, and the sandbox blocks pop-up dialogs. The preview frame is small, and the page shows no console or error output.
  • The Clear button empties the boxes and the result line, but the preview frame keeps showing the last run. The Copy result button copies only the short status line, not your code.

Tips

  • Put your code in one place, such as a text file, before you press Clear, because the boxes are not saved.
  • Test small changes one at a time. With no error panel, a typo can make the preview simply look wrong.
  • Use inline CSS and a data: image if you need an image, since links to outside files will not load.

Sources

Common questions

About HTML CSS JavaScript Playground.

How do I use the HTML CSS JS playground?

Write HTML, CSS and JavaScript in the three boxes, then press the main button. The code runs in a sandboxed preview frame under the boxes. Edit the code and press the button again to refresh the preview.

Is my code uploaded to a server?

No. The tool runs in your browser, and your input is not uploaded. The preview is built locally from the three boxes and shown in a frame on the same page.

Is it safe to run code I do not trust?

The frame is sandboxed. It has no same-origin access, cannot reach this page's storage, and its policy blocks network requests. Even so, do not paste code you do not understand, and do not type secrets into it.

Why does my external script, font or image not load?

The preview uses a strict content policy that blocks every outside address. Only inline styles, inline scripts and images given as data: or blob: addresses are allowed, so links to a CDN or another site will fail.

Why can't I see console.log output or errors?

The tool has no console panel and shows no error messages. If a script fails, the earlier changes it made can remain in the preview. Test small pieces to find a problem, or use your browser's own tools in another page.

Does it save my work?

No. The boxes are not stored, and Clear empties them. Copy your code to a file or a note elsewhere if you want to keep it.

How do I use HTML CSS JS playground?

Write HTML, CSS and JavaScript, then press Run to see a local preview.

Is my data uploaded to a server?

No. This tool runs locally in your browser. Your input is not uploaded.