Skip to content
DoItJag

HTML Live Previewer

Check what a piece of HTML looks like without saving a file and opening it in a browser. Paste a full page or a fragment, add CSS in the second box if you like, and the preview redraws as you type. Switch between full, tablet and phone widths, then download everything as one .html file.

About the HTML Live Previewer

Sometimes you only want to see what a snippet looks like: a block copied from a tutorial, an email template from a colleague, a fragment from a CMS that renders oddly. Saving it as a file and opening it in a browser every time you change a character is slow. Here the page redraws a moment after you stop typing.

How to use the two boxes

The HTML box takes either a complete document, with doctype, head and body, or just a fragment such as a single table. Styles written in a style block or in style attributes are applied. The CSS box is optional and is added after any styles already in the HTML, so it wins when both set the same thing.

Worked example

Press Try an example. A pricing card appears on a light grey background, with a shadowed white panel, a blue price and a button. Now switch to Phone (375 px). The card keeps its maximum width of 320 pixels and still fits. Change max-width: 320px to max-width: 500px in the CSS box and look at the phone view again: the card now overflows the narrow screen, the kind of issue this view is meant to reveal.

What is deliberately left out

The preview is built for looking, not for running code. Scripts and event handlers are removed, forms cannot be submitted and links do not navigate (hover over one to see where it points). Pictures, fonts and stylesheets hosted on other websites are not fetched either, so no outside server learns that you opened the page. A short note under the preview tells you how much was left out. If you need JavaScript to run, open the downloaded file in your own browser instead.

Saving your work

Download HTML file puts the CSS box into a style block in the page head and saves one self-contained file. Copy HTML with CSS gives the same text for pasting elsewhere. Nothing is stored on this site, so download before you close the tab.

How to use HTML Live Previewer

  1. Paste or type HTML in the first box and, optionally, CSS in the second (or press Try an example).
  2. Watch the preview update; switch the width to see how it looks on a phone or tablet.
  3. Download the page as one .html file, or copy the HTML with the CSS included.

Privacy: how it works

Everything happens in your browser. Your code is not sent to any server.

Frequently asked questions

Why does my JavaScript not run?

For safety the preview never runs scripts or event handlers such as onclick, so code pasted from anywhere cannot do anything in your browser. It shows the HTML and CSS only; the page says how many scripts were left out.

Why are my images missing?

Images, fonts and stylesheets on other websites are not loaded, so this page never contacts another site. Images written into the code as data: URIs do show.

Can I preview an email template?

Yes, inline styles and style blocks are applied. Email programs support less CSS than browsers, so test in the real program before sending.