How to use the HTML Viewer & Editor
- Paste or type HTML in the left box, or open an .html file.
<style>and<script>tags work as usual. - The preview on the right updates as you type. Untick Live and press Run (or Ctrl+Enter) to update only when you choose.
- Switch between Full, Tablet and Phone to test responsive layouts, or open the preview full screen.
- Check Console for
console.logoutput and JavaScript errors, then download your page as an .html file.
Safe by design
Your code runs in a sandboxed frame that's cut off from this website, your cookies and your other tabs. Scripts can run and show alerts, but they can't read or change anything outside the preview. Nothing is uploaded: your code stays in your browser, and the last thing you typed is kept there for your next visit.
What you can do with it
- Preview an HTML email or a snippet from a tutorial before you use it.
- Open an .html file someone sent you to see what it does, safely.
- Try out CSS layouts and see how they behave at phone and tablet widths.
- Test small JavaScript experiments, with
console.logoutput shown under the preview.
Tips
- Press Tab to indent. To move on with the keyboard, press Esc first, then Tab.
- Images and stylesheets from other websites load as long as you use full
https://links. - To tidy up messy code, try the CSS formatter and minifier.
- To save your page as a PDF, paste the HTML into HTML to PDF on our sister site, curlytab.
Frequently asked questions
Is it safe to open HTML I don't trust?
Much safer than opening the file directly: the preview runs in a sandbox without access to this site, your cookies or other tabs. Even so, don't type passwords into forms in pages you don't trust.
Is my code saved?
Your latest code is kept in this browser only, so it's there next time. Click Download .html to keep a copy.
Can I use JavaScript libraries?
Yes. Add a <script src="https://…"> tag that points to a CDN such as cdnjs or jsDelivr.
Why doesn't my relative image link work?
The preview has no folder to look in, so links like images/logo.png can't load. Use a full https:// address, or turn the image into a data URI with Image to Base64.
Updated