Home/Developer Tools/Real-Time HTML Editor
🖊

Real-Time HTML Editor

FREE

Write HTML, CSS and JS with a live preview

Free · No sign-up required
Loading...

What the real-time HTML editor does

Write HTML — with inline CSS and JavaScript if you like — on the left and see it rendered on the right as you type. There is no save step, no reload and no project to set up. It is a scratchpad for trying a layout idea, checking how a snippet from a tutorial looks, debugging a fragment copied from a page, or teaching HTML with instant feedback. Rendering happens in a sandboxed frame in your browser; nothing is uploaded.

What goes in the editor

<style> .card { padding: 16px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.1); } </style> <div class="card"> <h2>Hello</h2> <p>Edit me and watch the preview update.</p> <button onclick="this.textContent = 'Clicked'">Click</button> </div> <script> console.log("Scripts run too"); </script>

A full document with <html>, <head> and <body> works, and so does a bare fragment — the preview wraps it in a document for you. Styles and scripts can be inline or loaded from a CDN with <link> and <script src>.

How the preview works

  • The markup is written into an <iframe> via srcdoc on every change, so the preview is a real document with its own DOM, styles and scripts.
  • The frame is sandboxed from the tool's own page: your CSS cannot restyle the editor and your scripts cannot reach its DOM.
  • Scripts re-run on every update. Side effects such as timers restart each time you type; keep experiments small.
  • Console output from the preview appears in the browser's devtools console, not in the editor.

Common uses

  • Prototyping a component or a layout before building it in a framework.
  • Testing an email or newsletter fragment's rendering (remembering that email clients are stricter).
  • Checking a code sample from Stack Overflow or MDN actually does what it claims.
  • Teaching and learning HTML and CSS with immediate visual feedback.
  • Building a quick mock-up to screenshot for a bug report or a design discussion.
  • Debugging a fragment copied out of a larger page in isolation.

Editor vs CodePen-style tools

This editorCodePen / JSFiddle / StackBlitz
SetupNoneAccount for saving
PrivacyNothing leaves your browserPens are stored on their servers (private pens on paid plans)
Preprocessors (Sass, TypeScript, JSX)NoYes
Sharing a linkNo — copy the codeYes
Speed to first resultInstantA few seconds

Use this for quick, private experiments; move to a hosted playground when you need to save, share or use a framework.

Frequently asked questions

Can I load a library like Bootstrap or Tailwind?

Yes — add a <link> or <script src> tag pointing at a CDN in your markup, exactly as on a real page.

Why doesn't my fetch() work?

The preview is a sandboxed document with a null origin; requests to APIs that require CORS with a specific origin will fail. Public APIs that allow any origin work.

Where is console.log output?

In the browser's developer tools console (F12). The preview frame logs there like any page.

Is my work saved?

No. Copy the code before closing the tab. Nothing is stored or transmitted.

Can I see how it looks on mobile?

Use the browser's device toolbar in devtools on the preview frame, or resize the window — the preview is a normal responsive document.

Why does an alert() or prompt() not appear?

The sandbox blocks modal dialogs. Use console.log or write to the page instead.

More tools in this category

📋
JSON Tools
View tree, format, validate and minify JSON
📄
YAML Beautifier & Validator
Format YAML and find the line that breaks it
📋
XML Tools
Beautify, validate and convert XML to JSON
🗃
SQL Formatter & Minifier
Lay out SQL clause by clause, or collapse it to one line
📝
Markdown Tools
Preview Markdown, convert to HTML and generate tables
🔑
JWT Encoder & Decoder
Decode a JWT's header and payload, or sign one with HS256