HTML Live Runner

Write HTML+CSS+JS on the left, live preview in the iframe on the right. Run and clear supported.

Code runs in an iframe sandbox and never leaves your browser.

HTML live runner: what the iframe sandbox can and cannot do

How the preview is built

The preview on the right is an iframe. You write HTML, CSS and JS on the left, hit run, and the code is placed inside that iframe to render. The key feature is that your code executes in a separate document environment, not injected straight into the current page. That gives two direct benefits:

Relative-path resources will not load

The most common confusion: an <img src="./logo.png"> or a <link href="/style.css"> will not show in the preview.

The reason is no base URL. The preview content is an independently injected document that belongs to no real server directory, so relative paths have nothing to resolve against. Three workable options:

OptionNote
Use a full URLhttps://example.com/logo.png loads (if the other side allows cross-origin)
Inline the resourceturn images into data URIs, put CSS in a <style> block, JS in a <script> block
Use a CDN linkfor frameworks or fonts use a full CDN address (unpkg, jsdelivr)

The second option is exactly where this site's "image to Base64" tool earns its keep: turn an icon into a data URI and paste it into the preview with no external dependency.

Network requests and cross-origin limits

The preview can use fetch or XMLHttpRequest, but the browser same-origin policy applies:

What it can and cannot do

Good forNot for
quickly checking an HTML/CSS layoutprojects needing a build step (bundling, transpiling, module resolution)
trying CSS properties, animation, transitionsprojects depending on npm packages (unless a CDN build exists)
testing string handling, regex, date logicNode.js code (file system, process, native modules)
showing someone a minimal runnable examplefull back-end features (login, persistence, database)
verifying behaviour in a minimal environmentperformance benchmarks (iframe differs from a real page)

On the last row: render timing, font loading and resource priority all differ inside an iframe, so performance numbers measured here are only indicative, not authoritative.

Peculiarities of the preview environment

How the tool works

Edit HTML on the left (you can embed <style> and <script>), hit run, and the right iframe renders instantly. Everything stays local — the code never leaves your device, which is essential when testing internal page structure, unpublished components or snippets with business logic. To debug, right-click the iframe and choose Inspect to see its DOM and console in devtools — the direct way to trace a JS error in the preview.

FAQ

Can I include external JS libraries?

Yes, include a CDN with <script src="..."> in the code, but only reference sources you trust.