How to use the HTML viewer
- Write or paste HTMLType in the editor, paste a full page, or press Sample to load an example. CSS and JavaScript inside the page work too.
- Watch the live previewThe preview updates as you type. Switch to phone or tablet width to check your layout on smaller screens.
- Go big and savePress Expand for a full-screen editor, drag the divider to resize, then copy or download your finished file.
What you can do
- Live preview
- See your page render as you type, or turn Auto-run off and press Run (Ctrl + Enter) when you are ready.
- Phone and tablet sizes
- Preview at 375px (phone) and 768px (tablet) to test responsive layouts and media queries.
- Full-screen editing
- Expand the editor to fill your screen, then choose side by side, stacked, code only or preview only.
- Built-in console
- Messages from console.log and JavaScript errors appear in the Console panel, so you can debug without opening developer tools.
- Code colors and line numbers
- Tags, attributes and strings are colored, tags close automatically, and matching tags are highlighted.
- Autosave, copy and download
- Your code is kept in this browser between visits. Copy it, download it as index.html, or open the result in a new tab.
Keyboard shortcuts
| Action | Shortcut |
|---|---|
| Run the code now | Ctrl + Enter |
| Save in this browser | Ctrl + S |
| Comment or uncomment lines | Ctrl + / |
| Indent or outdent | Tab / Shift + Tab |
| Leave full screen | Esc |
On a Mac, use Cmd instead of Ctrl.
About the HTML viewer
An HTML viewer lets you see what a piece of HTML looks like without creating files, saving them and refreshing a browser. Paste a snippet from a tutorial, an email template or a page you are building, and the result appears straight away next to the code.
It is useful for learning HTML, because every change shows up immediately; for prototyping layouts and components; for debugging a snippet in isolation; and for checking responsive design at phone and tablet widths.
Your code runs inside a sealed preview frame, so it cannot change this page or read anything from your browser. Nothing is uploaded: the editor, the preview and the autosave all work on your own device.
Want separate boxes for HTML, CSS and JavaScript? Use the HTML, CSS & JS Live Editor. This viewer is best for single files and full HTML pages.
Frequently asked questions
Can I use CSS and JavaScript in the HTML viewer?
Yes. Put CSS inside a <style> tag and JavaScript inside a <script> tag, just as you would in a normal HTML file. Both run in the preview.
Is it safe to run code here?
Yes. The preview runs in a sandboxed frame that is separated from this website, so the code cannot change the page, read your data or access other sites' cookies.
Is my code saved or uploaded anywhere?
Your code is never uploaded. It is stored only in this browser so it is still here when you come back. Clearing your browser data, or pressing the bin icon, removes it.
Can I load external libraries like Bootstrap or Google Fonts?
Yes. Add the usual <link> or <script> tags with their CDN addresses and they will load in the preview, as long as you are online.
Why does my page look different from my live website?
The preview only knows about the code in the editor. If your site uses separate CSS files, images or scripts with relative paths, add them with full web addresses so the preview can load them.
Does the HTML viewer work on phones?
Yes. On small screens the editor switches to Code and Preview tabs, and you can still preview at phone and tablet widths.