Online HTML Editor

Write HTML, CSS, and JavaScript with real-time live preview

Panel Height:
600px

Live Preview

Console output will appear here...

About This HTML Editor

Our free online HTML editor lets you write HTML, CSS, and JavaScript code and see the results instantly in a live preview. Perfect for learning web development, testing code snippets, or quickly prototyping ideas.

Key Features

  • Live Preview - See your changes instantly as you type
  • Separate Panels - Write HTML, CSS, and JavaScript in dedicated editors
  • Console Output - View console.log output without opening browser DevTools
  • Export to HTML - Download your creation as a standalone HTML file
  • Share Your Code - Create shareable links to your code snippets
  • No Signup Required - Start coding immediately, no account needed

Use Cases

  • Learning HTML/CSS/JS - Practice web development fundamentals
  • Quick Prototypes - Test ideas before adding to your project
  • Code Snippets - Share working examples with teammates
  • Bug Reproduction - Create minimal reproductions for debugging
  • Teaching - Demonstrate concepts with live, editable examples

Tips

  • Use console.log() in your JavaScript to see output in the Console panel
  • The preview runs in a sandboxed iframe, kept separate from the rest of the page
  • Code opened from a shared link waits for you to press "Run shared code" before it runs
  • Press Tab in the editor to insert spaces for indentation
  • Click "Load Sample" to see an example project

How the Live Preview Works

The three editors are just separate text areas for your HTML, CSS, and JavaScript. Every time you type, the tool stitches them into a single HTML document and hands that document to an <iframe> through its srcdoc attribute: your CSS is wrapped in a <style> block in the head and your script is placed just before the closing body tag, exactly as a real page would be. The update is debounced by a fraction of a second so the preview stays responsive while you type instead of re-rendering on every keystroke. All of this happens locally in your browser; your code is never sent to a server.

To surface errors and logs without opening browser DevTools, the editor injects a small script that wraps console.log, console.warn, and console.error and forwards their messages to the Console panel below the preview. A window.onerror handler catches uncaught exceptions too, so a typo in your JavaScript shows up as a red line rather than silently failing.

About the Sandbox

The preview iframe carries a sandbox="allow-scripts" attribute. allow-scripts is what lets your JavaScript run at all, and leaving out allow-same-origin means the preview is treated as a separate site from Fix42, so the code inside it cannot read this page or anything your browser has saved for it. One side effect is that localStorage, sessionStorage and cookies are not available inside the preview, so code that uses them will show a security error in the Console panel here even though it would work on a real page. The sandbox keeps the preview contained, but it does not check what your code does inside it, so it is still worth reading a snippet before you run it.

Frequently Asked Questions

Does my code get uploaded anywhere?

No. The editor assembles your HTML, CSS, and JavaScript into a document and renders it in an in-page iframe entirely within your browser. Nothing is sent to a server unless you deliberately create a share link, which encodes the code into the URL.

Why can I see console.log output without opening DevTools?

The tool injects a small wrapper around console.log, console.warn, and console.error inside the preview and forwards their messages to the Console panel. Uncaught errors are captured through a window.onerror handler, so mistakes appear as red lines in that panel.

Can I load external libraries or images?

Yes. Because the preview is real HTML, you can add a script or link tag pointing at a CDN, or reference an image by its full URL, and it will load as it would on any web page. Relative paths will not resolve, since there is no hosting folder behind the preview.

How do I save my work?

Use "Export HTML" to download everything as a single standalone .html file you can open or host anywhere. The share button gives you a short link that shows your HTML, CSS and JavaScript, and its "Open in HTML Editor" button loads all three back into the editor with the preview running. The editor does not keep your work after you close the tab.

What does the Pan mode do?

Pan mode renders the preview at a fixed 1920x1080 canvas and lets you drag or scroll around it, similar to moving around a design in Figma. It is useful for inspecting how a wide desktop layout looks without shrinking it to fit the panel.