01 / Sandbox
Scripts off
The frame runs with scripts off. A switch turns them on, with a warning, and a console shows what they log.
Free tool
Paste HTML or open an .html file and the page shows beside the code, live. It runs in a sandboxed frame with scripts off until you switch them on, so a page you do not trust cannot touch anything. Drop the style sheets and pictures that go with the page and they work too. Preview at phone, tablet or laptop width, or any width you type, in full screen if you like. Format or minify the code, then save it. Nothing is uploaded.
The page shows here.
Paste HTML on the left, or open a file.
What the page logs with console.log shows here, and its errors.
The page
Scripts can run code and open pop-ups. Switch this on only for code you trust. The frame cannot reach this page, your cookies or anything stored in this browser.
Code
Keys
Your HTML is shown by your browser, in a frame that cannot reach this page. It is never uploaded or saved. Only your settings are remembered on this device.
Safe by default
01 / Sandbox
The frame runs with scripts off. A switch turns them on, with a warning, and a console shows what they log.
02 / Files
Open an .html file together with its CSS, JavaScript and pictures and the page finds them by name.
03 / Widths
Check a layout at 390, 768 or 1280 pixels, or at a width you type, and see the page respond.
Guide
An HTML viewer shows what a piece of HTML code looks like as a web page. You paste the code, or open a file, and the page appears right beside it. This one updates as you type, runs the page in a sandboxed frame with scripts off unless you allow them, and previews it at phone, tablet and laptop widths. You can also format the code so it is easy to read, shrink it with the minifier, and save the result as an .html file. Everything happens in your browser.
The page runs in an iframe with the sandbox attribute set. With Allow scripts off, no JavaScript in the page runs at all, so you can look at a snippet from an email or a forum without it doing anything. Switching Allow scripts on lets the page run its own scripts, and a Console strip appears under the page showing what it logs with console.log and any errors. Even then the frame has no access to this page, its cookies or its storage, and a page that tries to use localStorage will get an error. Links in the page open in a new tab.
The switch Load pictures, styles and fonts from other sites controls links such as an image from another website. Leave it on to see the page as it will look online. Turn it off to see only what is in your own code and files, which is a quick way to find out what the page depends on. The note under the page counts how many outside files it asks for.
A saved web page often points to files next to it: style.css, app.js, logo.png. Choose them all together in Open files, or drop them all on the code box. The .html file goes into the editor and the others are matched by file name. A style sheet linked with link rel="stylesheet" and a script with a src are put into the page, and pictures, fonts and media are linked. Folders in the path are ignored, so two files with the same name in different folders will clash. Remove them clears the extra files.
Format puts each block element on its own line and indents what is inside it, using 2 spaces, 4 spaces or tabs from the Indent setting. Text and inline tags such as links and bold stay together on a line, and long lines are wrapped. Content in pre and textarea is left exactly as it is. Tags that were left open, such as a missing closing li or p, get their closing tag.
Minify removes comments (untick Remove comments when minifying to keep them) and the spaces between blocks, and shortens the code inside style tags. It keeps one space between inline items, because that space is visible. Code inside script tags is kept as written apart from the spaces at its ends, so a script is never changed in a way that could break it. The status line shows the size before and after.
| Part of the code | Format | Minify |
|---|---|---|
| Comments | Kept | Removed, or kept if you untick the setting |
| Spaces between blocks | One tag to a line, indented | Removed |
| Text in a paragraph | Kept on a line, wrapped when long | Runs of spaces become one |
| pre and textarea | Not changed | Not changed |
| style tags | Re-indented | Shortened |
| script tags | Re-indented | Ends trimmed, otherwise not changed |
The frame is given the width you pick, so CSS media queries respond to it just as they would on a screen of that width. The example page called Pricing cards shows this: three cards side by side at Laptop, and stacked in one column at Phone, because its style says so at 480 pixels and under. Fit uses the space the preview has. If the code has a viewport meta tag, as a mobile page should, it is read, but the preview itself is not a phone, so touch and device pixel behaviour are not simulated.
images/a.png only work if you open the picture with the page. Or use full web addresses with the outside files switch on.To turn a page into a document, use HTML to PDF. To write the content in plain text first, try the Markdown editor or Markdown to HTML. To tidy a data file, see the XML formatter.
Questions
Click Open files and choose the .html file, or drop it on the code box. The page shows beside the code. If it uses a style sheet or pictures, choose those at the same time.
With Allow scripts off, no script in the page runs, and the frame cannot reach this page or its data. Leave scripts off for anything you are unsure about, and turn off the outside files switch if you do not want the page to load anything from other sites.
Scripts are off by default. Switch on Allow scripts in the side column. A console under the page then shows what the script logs and its errors.
Yes. Click Phone for a 390 pixel wide frame, Tablet for 768, or type any width. Media queries in the page respond to that width. It does not simulate touch or a phone's pixel density.
Yes, if you choose the files together in Open files. They are matched by file name. Pictures and style sheets with full web addresses load from their site when the outside files switch is on.
It shows the page as the browser reads it. Format adds closing tags that were left out and tidies the layout, but it is not a validator and does not point out errors.
It removes comments and extra spaces and shortens style rules. Scripts, pre and textarea are not changed beyond their ends. Check the page after you minify.
No. It stays in this tab. Only your settings, such as the indent, are remembered, never the code. Closing the tab clears it, so download it first.
Yes. The code box is an editor with colours, line numbers, auto indent and Tab to indent. The page updates as you type.