Skip to content
Developer

HTML Preview

Three panes and a live preview. The result renders in a sandboxed iframe that cannot reach this page, and errors inside it are surfaced instead of vanishing.

Preview

Runs in a sandboxed frame with no access to this page. Errors appear at the bottom of the preview.

About the HTML Preview

Sometimes you just need to see what a fragment of markup does. Opening an editor, creating a file, and finding a browser to point at it is more ceremony than the question deserves, and most online editors want an account before they will show you a rendered div.

The preview runs in an iframe with the sandbox attribute set to allow scripts but not same-origin access. That combination is what makes it safe: code in the frame is treated as coming from a unique origin, so it cannot read this page's DOM, its storage, or anything else belonging to the site. You can paste a stranger's snippet and find out what it does without it finding out anything about you.

Errors inside a sandboxed frame normally disappear — they land in the frame's own console, which is not where you are looking. A small error handler inside the preview catches them and shows the message and line number on top of the result, so a typo in your JavaScript announces itself rather than manifesting as nothing happening.

The three panes are separate rather than one HTML document because that is how the code will eventually be organised, and because it means the CSS and JavaScript panes can be edited without hunting for the right tag. What runs is a single assembled document, which you can copy in full.

Nothing is uploaded, nothing is saved to a server, and the page works with the network disconnected once loaded.

Frequently asked questions

Is it safe to paste code I do not trust?

The frame is sandboxed with scripts allowed but same-origin access denied, so code inside it is treated as a foreign origin and cannot reach this page, its storage or its cookies. As always, read anything you run.

Where do JavaScript errors show up?

On top of the preview. Errors inside a sandboxed frame normally go to the frame own console where you will not see them, so they are caught and displayed with the line number.

Is my code saved anywhere?

Only in your browser. There is no account and no server; closing the tab discards it.