What is an HTML viewer?
An HTML viewer renders the HTML and CSS you paste, right next to the code, so you can see the page without creating a file, opening a local server or deploying anything. It is the quickest way to try a snippet from a tutorial, check how an email template or a landing section looks, debug a layout, or show a colleague a small example.
This online HTML viewer updates the preview shortly after you stop typing and lets you switch between full width, tablet (768 px) and phone (375 px) to see how the layout responds. The important part is safety. The preview runs inside an isolated frame with a strict Content Security Policy (default-src 'none'): no JavaScript runs, no request goes out to the network, and the page inside cannot reach this site. So you can paste a snippet you do not trust, from a forum or an email, and see what it looks like without risk. Inline CSS works, and images, fonts and media embedded as data: addresses work. Your code stays in memory in your browser; it is not put in the address, not stored and not sent.
How to preview HTML
- Paste or type your HTML in "HTML code". The page opens with a sample so the preview is never empty.
- Watch the "Preview" panel. It refreshes about 200 ms after your last keystroke.
- Choose "Full width", "Tablet (768 px)" or "Phone (375 px)" to check the responsive layout. The choice is remembered.
- Read the notices under the preview. "Scripts and event handlers found" counts
<script>tags and attributes such asonclick; they are shown but do not run. "Resources from other sites found" lists images, stylesheets and fonts loaded from other addresses; they are not loaded. - To see an external image or font, embed it in the page as a
data:address, or copy its styles inline. - Copy your code back out of the editor when you are happy with it.
Examples
A simple heading and style
<style>h1{color:#c0392b}</style><h1>Hello</h1> shows a red heading. The code is wrapped with a doctype automatically when you did not include one, so the page renders in standards mode.
A page with a script
<button onclick="alert(1)">Go</button><script>alert(2)</script> shows the button, but nothing happens when you click it. The notice reports 2 scripts and handlers found: the <script> tag and the onclick.
A remote image
<img src="https://example.com/a.png"> is not loaded; the notice lists https://example.com/a.png as an external resource. The same image written as src="data:image/png;base64,..." appears.
Testing the phone layout
A page with <meta name="viewport" content="width=device-width, initial-scale=1"> and a media query @media (max-width: 600px) changes its layout when you pick "Phone (375 px)", without resizing your window.
Common mistakes
- Expecting JavaScript to run. It is disabled on purpose. To test behaviour, use your browser's developer tools or a code playground.
- Using remote CSS and fonts. A
<link rel="stylesheet" href="https://...">is blocked. Paste the CSS in a<style>block. - Relative paths.
src="logo.png"points to nothing in a pasted snippet. Use adata:address. - Trusting it as a validator. Browsers are forgiving: a page that looks right can still have invalid HTML. Check unclosed tags separately, for example by formatting the code.
- Confusing the preview with the final page. Without scripts and web fonts, the rendering can differ from production.
FAQ
Is it safe to paste unknown HTML?
Yes for viewing: scripts and network requests are blocked and the frame is isolated from this site. Still, do not trust a snippet's links, and do not type passwords into a pasted form.
Why does my external stylesheet not load?
The Content Security Policy only allows inline styles and data: resources. It is what guarantees that the preview makes no network request.
Can I save the page?
Copy the code from the editor and save it as an .html file. To turn Markdown into HTML first, use the Markdown to HTML converter.
Does it work offline?
Once the page has loaded, yes: it does not need a server to render the preview.
Can I edit visually instead of writing code?
For a visual editor, see the HTML WYSIWYG editor, which produces the markup for you.