HTML Preview

Type HTML on the left and see it rendered instantly on the right. Runs in a fully locked-down sandbox, with no server and no script execution.

Preview

You've got an HTML snippet in front of you and want to know what it looks like before it ends up anywhere. Normally that means creating a file, opening a browser, switching tabs, switching back. Here you skip the detour. You type your markup on the left and see the result on the right immediately, with no project of your own and no build step.

The tool is meant for a quick look, not for building a full layout. A snippet from an email, an answer from ChatGPT, an old code fragment from some folder. Before you paste something like that anywhere, you want to know what it actually displays.

How it works

You type in the left field. The preview on the right updates with every keystroke. No button to trigger it, no waiting, no server in between. By default there's a short example with a heading and a paragraph. Select it and replace it with your own markup.

The preview runs in an iframe with the attribute sandbox="", so without a single permission token. That's the strictest level the iframe standard knows. sandbox works like an allowlist: only what's explicitly permitted gets to run.

Without allow-scripts the frame doesn't execute a single <script> tag, it just sits in the markup with no effect. Without allow-forms no form submits, without allow-popups no new window opens, and without allow-same-origin the frame can't access this page, even if someone in the pasted code tried.

One last point that helps when you're testing someone else's code: nothing you paste leaves your browser. There's no upload and no request to any server. The text stays local in the tab, even if it looks like a complete form or an embedded widget.

When you need it

Most often for markup you don't trust yet. A client sends an embed snippet. A colleague sends an HTML fragment from an old CMS. A chatbot hands you code and claims it produces a certain structure. Before any of that moves into a real page, you check it here. A script inside it never actually runs.

It's just as handy for learning. If you're only starting to get HTML, you see right away what a <ul> does compared to an <ol>, or how nested <div>s affect the structure, without setting up an editor and a local server. And for yourself, when you're in the middle of something else and want to remind yourself how a tag behaves: snippet in, read the result, keep working.

What a sandboxed iframe blocks, and what it doesn't

The sandbox value is a set of individual tokens. Each one unlocks exactly one capability:

  • allow-scripts for JavaScript
  • allow-forms for submitting forms
  • allow-popups for new windows or tabs
  • allow-same-origin so the frame keeps its own origin instead of running as an empty null origin
  • allow-top-navigation so the content may redirect the parent page

This tool sets none of them. What's left is pure markup and pure CSS. Which is what you want for a preview where you don't know what the pasted code actually contains.

What still works: everything the browser renders without a script. Headings, paragraphs, lists, tables, and forms as pure structure. Embedded CSS via <style> tags, even CSS animations, because they don't need JavaScript. Only behavior that actively runs code stays off.

Two traps when testing fragments

A snippet without its own <style> stays unstyled. The iframe only gets what you paste. It doesn't inherit styles from this page or from any other source. If you want to see how an element looks with its real CSS, the CSS goes into the same box, either inline in the style attribute or in its own <style> block.

Relative paths don't work either. An <img src="logo.png"> points at nothing in the sandboxed frame, because allow-same-origin isn't set. So the frame has no fixed origin a relative path could resolve against. For images you need a full URL or a data URI with the image embedded directly.

What it can't do

It's a preview, not an editor with extras. It doesn't clean up pasted inline styles, doesn't minify anything and doesn't reformat nested code to make it readable. If you want to process text from Word or Google Docs cleanly, the Markdown editor is the better starting point. It produces real rich text instead of just showing a preview.

There's also no copy button, no reset and no storage. Close the tab or reload the page and the text is gone, so copy your result before you click away. And because no script runs, you also won't see how dynamically generated markup behaves. For a component that only gets its final structure through JavaScript, you need a real development environment, not a sandboxed preview.

If you build code more often than you just check it, have a look at twelve more free tools. They came about for exactly the same reason: for tasks where a full project would be overkill. If you want to know how a coding agent builds entire WordPress themes, that's the other end of the scale, valid Gutenberg markup included.

FAQ

Does JavaScript run in the preview?
No. The iframe carries sandbox="" without a single permission token, and without allow-scripts the browser doesn't execute any script tag, it just sits in the markup doing nothing. Without allow-forms no form submits, without allow-popups no window opens, and without allow-same-origin the frame can't reach this page. So you can throw untrusted markup in without worrying.
Why does my snippet look unstyled?
The frame only gets what you paste and inherits no styles from this page. If you want to see an element with its real CSS, the CSS has to go into the same box, either inline in the style attribute or in its own style block. CSS animations do run, by the way, since they don't need JavaScript.
Why isn't my image showing?
Because relative paths lead nowhere. Without allow-same-origin the frame has no fixed origin that a path like logo.png could resolve against. Use a full URL starting with https, or embed the image as a data URI.
Is my code saved?
No. There's no upload, no request to a server and no storage. Reload the page or close the tab and the text is gone, so copy your result out first.