HTML Previewer

Paste raw HTML and instantly see the rendered output. Prettify, copy, and test responsive layouts at desktop, tablet, and mobile widths. Free online tool.

About the HTML Previewer

Paste raw HTML and see it rendered instantly. Test responsive layouts at desktop, tablet, and mobile widths. Prettify, minify, and copy your code. Start from five ready-made templates or write from scratch. Free, private, and no signup required.

The HTML Previewer is a free online tool that lets you paste raw HTML code and instantly see how it renders in a browser. Whether you are building an email template, debugging a blog post, testing AI-generated markup, or learning HTML basics, this tool gives you a live visual preview without needing to save files or open a code editor.

Who Uses an HTML Previewer

Email marketers use it to test newsletter layouts before sending to thousands of subscribers — catching broken tables and misaligned columns before they go live. Web developers paste code snippets to verify rendering without switching to a browser tab. Content managers preview blog posts exported from CMS platforms like WordPress, Ghost, or Substack to ensure formatting survived the transfer. Students learning HTML get instant feedback on every tag they write, turning abstract syntax into visible results. And anyone working with AI-generated HTML can paste Claude or ChatGPT output to verify it actually looks right before using it.

How It Works

Paste or type HTML into the input area, and the rendered output appears instantly in the preview pane below. The preview is sandboxed using an iframe for security — scripts will not execute, keeping your browser safe while you experiment with any markup. A 300-millisecond debounce prevents the preview from flickering while you type, giving you a smooth live-editing experience.

Built-In Formatting Tools

The Prettify button auto-formats messy or minified HTML into readable, indented code with proper nesting — following the same conventions described in the MDN HTML guide. The Minify button does the reverse — stripping whitespace and comments to produce the smallest possible output, useful for email templates with character limits or embedding HTML in other systems. Copy puts your HTML on the clipboard with one click. And the responsive toggle previews your work at desktop, tablet (768px), and mobile (375px) breakpoints — essential for testing layouts that need to work across devices.

Starter Templates

Start from one of five ready-made templates instead of a blank page. The templates are loaded from our database, so new ones appear automatically as we add them:

Email Newsletter

A complete newsletter layout with branded header, body text, call-to-action button, and unsubscribe footer. Uses inline CSS for maximum email client compatibility, following the patterns recommended by Can I Email.

Blog Post

A structured article with headings, paragraph text, lists, inline code samples, and a styled blockquote. Demonstrates semantic HTML using article, h1, h2, ul, and blockquote elements — the same markup structure that search engines prefer for content indexing.

Landing Page

A hero section with gradient background and call-to-action button, plus a three-column feature grid using CSS grid layout. Shows how to combine visual design with semantic structure in a single HTML document.

Data Table

A formatted sales report with header row, numeric alignment, and color-coded status badges. Demonstrates proper table structure using thead, tbody, th, and td — skills that transfer directly to building data tables in tools like the Board Feet Calculator or any data-heavy application.

AI Exposure Comparison

A multi-row comparison table with color-coded risk scores, role descriptions, and smart pivot recommendations. Shows advanced table techniques including colspan, conditional row colors, and badge-style spans — patterns useful across any ProCalc domain from Finance to Engineering.

Stats and Analysis

A live stats bar tracks four metrics as you work: character count (total HTML length including tags), word count (visible text only with tags excluded), line count, and HTML element count (number of opening tags). These are useful for checking email template size limits — Gmail clips emails over 102KB — estimating content length for SEO, or verifying that your markup structure matches expectations.

Privacy and Security

No signup required, no data sent to any server. Your HTML stays entirely in your browser, rendered in a sandboxed iframe that prevents script execution and blocks access to your cookies, local storage, and other page data. Templates are loaded from our database, but everything you type or paste remains on your device. Use this tool freely with confidential content, proprietary code, or client work.

HTML Quick Reference

HTML documents are built from elements — tags that wrap content and give it meaning. The full HTML reference at MDN covers every element, but here are the ones you will use most often:

Structural Elements

Use div as a generic container, section for thematic groups, article for self-contained content, header and footer for introductory and closing content, nav for navigation, and main for the primary content area. These semantic elements help screen readers and search engines understand your page structure.

Text and Content

Headings from h1 (largest, most important) through h6 (smallest) create a document outline. Paragraphs use p, inline text styling uses strong (bold) and em (italic), and br creates line breaks. For quoted content, use blockquote. For code samples, use code for inline snippets and pre for preformatted blocks.

Lists and Tables

Unordered lists (ul with li items) create bullet points; ordered lists (ol) create numbered sequences. Nest lists by placing a new ul or ol inside an li. Tables use a nested structure: table contains thead and tbody, which contain tr rows, which contain th (header) or td (data) cells. Use colspan and rowspan to merge cells across columns or rows.

Inline CSS Essentials

When external stylesheets are not available — as in email templates or embedded HTML — inline styles are the standard approach. The CSS reference at MDN documents every property, but the most common ones for inline use are:

Typography

Control typeface with font-family (stick to web-safe fonts like Arial, Georgia, and Courier for emails), size with font-size (use px for consistency), weight with font-weight (400 normal, 700 bold), and color with the color property. Line-height controls vertical spacing between lines — 1.5 to 1.8 works well for body copy.

Spacing and Borders

Padding creates space inside an element border; margin creates space outside it. Both accept values in px, em, or rem. Borders combine width, style, and color: border: 1px solid #e5e7eb is a standard light border. Add border-radius for rounded corners — 4px for subtle rounding, 50% for circles. Use border-collapse: collapse on tables to remove gaps between cells.

Layout

Modern CSS layout uses flexbox (display: flex with justify-content and align-items) and grid (display: grid with grid-template-columns). For email compatibility, stick to table-based layouts or simple block elements with explicit widths. The display property controls element flow: block takes full width, inline flows with text, inline-block combines both, and none hides the element.

Colors

Specify colors as named values (red, blue), hex codes (#FF0000), RGB (rgb(255, 0, 0)), or RGBA with transparency (rgba(255, 0, 0, 0.5)). Background-color fills an element; color sets text. For gradients, use background: linear-gradient(135deg, #1e3a5f, #2563eb) — though note that gradients do not render in Microsoft Outlook.

How to use the HTML Previewer

How to Use the HTML Previewer

Step 1: Enter Your HTML

Paste HTML code into the text area at the top, or click one of the starter templates in the preview panel to load a ready-made example. The template gallery shows five options with mini previews — click any card to load it instantly.

Step 2: Review the Live Preview

Your HTML renders immediately in the preview pane below. The preview updates as you type with a slight delay to keep things smooth. The sandboxed iframe shows exactly how a browser would render your markup.

Step 3: Test Responsive Layouts

Use the Desktop / Tablet / Mobile toggle in the toolbar to preview your HTML at different screen widths. Tablet simulates 768px (iPad portrait) and Mobile simulates 375px (iPhone). This is essential for email templates and responsive designs that use CSS media queries.

Step 4: Format Your Code

Click Prettify to auto-indent messy HTML into a readable format with proper nesting. Click Minify to strip all whitespace and compress the code for production use. Both operations are reversible — prettify then minify returns functionally identical code.

Step 5: Copy and Use

Click Copy HTML to put your code on the clipboard. Paste it into your email platform (Mailchimp, SendGrid, ConvertKit), CMS, blog editor, or code project.

Tips for Better Results

  • Email templates: Use inline styles on every element — most email clients strip style tags and external CSS. Check compatibility at Can I Email
  • Tables for Outlook: Microsoft Outlook uses the Word rendering engine, so use table-based layouts for maximum compatibility
  • Image widths: Always set explicit width and height on img tags to prevent layout shifts
  • Test all three viewports: A layout that looks perfect on desktop can break completely on mobile
  • Use the stats bar: Check character count against platform limits (Gmail clips at 102KB)
  • Validate your HTML: Run your code through the W3C Validator for a comprehensive syntax check

Switching Templates

The Templates button in the toolbar opens a dropdown with all available templates — including the Email Newsletter, Blog Post, Landing Page, Data Table, and AI Exposure Table. This works even when you already have HTML loaded — a warning reminds you that loading a template replaces your current content.

Related ProCalc Tools

If you work with structured data alongside HTML, check out the Board Feet Calculator for construction tables, the Wire Gauge Calculator for engineering data, or the Mortgage Calculator for financial layouts.

Formula

HTML & CSS Quick Reference

Essential HTML Tags

For the complete list, see the MDN HTML element reference.

Structure: <div> generic container, <section> thematic group, <article> self-contained content, <header> introductory content, <footer> closing content, <nav> navigation links, <main> primary content.

Text: <h1> to <h6> headings (h1 is the largest), <p> paragraph, <span> inline container, <strong> bold/important, <em> italic/emphasis, <br> line break, <hr> horizontal rule, <blockquote> quoted content, <code> inline code, <pre> preformatted text.

Lists: <ul> unordered (bullets), <ol> ordered (numbers), <li> list item. Nest lists by placing a new <ul> or <ol> inside an <li>.

Links & Media: <a href="url"> hyperlink, <img src="url" alt="description"> image (self-closing), <video> video player, <audio> audio player.

Tables: <table> container, <thead> header group, <tbody> body group, <tr> row, <th> header cell, <td> data cell. Use colspan and rowspan attributes to merge cells. See the MDN table guide for detailed examples.

Forms: <form> container, <input type="text|email|number|checkbox|radio"> input fields, <textarea> multi-line input, <select> with <option> for dropdowns, <button> clickable button, <label for="id"> accessible labels.

Inline CSS Properties

For the complete list, see the MDN CSS reference.

Typography: font-family (typeface), font-size (text size in px, em, or rem), font-weight (bold: 700, normal: 400), color (text color), text-align (left, center, right, justify), line-height (spacing between lines), text-decoration (underline, none), text-transform (uppercase, lowercase, capitalize), letter-spacing (space between letters).

Box Model: padding (space inside the border), margin (space outside the border), border (e.g., 1px solid #ccc), border-radius (rounded corners in px or %), width and height (element dimensions), max-width (responsive cap), box-sizing: border-box (include padding in width). See the MDN box model guide for visual explanations.

Colors & Backgrounds: color (text), background-color or background (fill), opacity (0 to 1 transparency). Color formats: named colors (red, blue), hex (#FF0000), RGB (rgb(255,0,0)), RGBA with alpha (rgba(255,0,0,0.5)).

Layout: display (block, inline, inline-block, flex, grid, none), position (static, relative, absolute, fixed), float (left, right — legacy), overflow (hidden, scroll, auto), z-index (stacking order for positioned elements).

Flexbox (on parent): display: flex, flex-direction (row, column), justify-content (center, space-between, flex-start, flex-end), align-items (center, stretch, flex-start), gap (spacing between items), flex-wrap (wrap, nowrap). See the CSS-Tricks flexbox guide for visual examples.

Grid (on parent): display: grid, grid-template-columns (e.g., repeat(3, 1fr)), gap (row and column spacing), grid-column (span across columns on children). See the CSS-Tricks grid guide for visual examples.

Email HTML Best Practices

Email clients strip most CSS. Follow these rules for maximum compatibility — verified against the Can I Email compatibility database:

  • Use inline styles only — no <style> tags, no external CSS
  • Use table-based layouts for Outlook (it uses the Word rendering engine)
  • Set explicit widths on images and tables (not percentages for Outlook)
  • Use web-safe fonts: Arial, Helvetica, Georgia, Times New Roman, Courier
  • Background images do not work in Outlook — use background-color as fallback
  • Keep total HTML under 102KB for Gmail (emails over this limit get clipped)
  • Always include alt text on images (many clients block images by default)
  • Use border-collapse: collapse on tables to remove cell gaps
  • Test at 600px max-width — the standard email container width
  • Use cellpadding and cellspacing attributes on tables for Outlook spacing
  • Validate your final HTML with the W3C Markup Validator before sending

Frequently asked questions

What is HTML and why do I need a previewer?

HTML (HyperText Markup Language) is the standard language for creating web pages. Every website you visit is built with HTML at its core. A previewer lets you see how your code will look in a browser without saving files or setting up a development environment. This is especially useful for testing email templates, debugging markup from a CMS, reviewing AI-generated HTML, or learning HTML by experimenting with tags in real time.

What HTML tags can I use in the previewer?

Any standard HTML tag works: structural tags like div, section, article, header, and footer; text tags like h1 through h6, p, span, strong, em, and blockquote; list tags like ul, ol, and li; table tags including table, thead, tbody, tr, th, and td; media tags like img (with external URLs) and video; form elements like input, select, and textarea; and link tags using a with href. Script tags are sandboxed and will not execute for security reasons.

How do I add CSS styles in the previewer?

Use inline styles with the style attribute directly on elements, like style="color: red; font-size: 16px". This is the most reliable method, especially for email templates where external stylesheets are stripped. You can also include a style tag inside your HTML for internal CSS that applies to multiple elements. The previewer renders both approaches. External stylesheet links will not load since the preview is sandboxed.

Why do email templates use inline CSS instead of stylesheets?

Most email clients (Gmail, Outlook, Yahoo) strip out style tags and ignore external CSS files. The only reliable way to style an email is with inline CSS on each element. This means writing style="font-family: Arial; color: #333333; padding: 16px" on individual tags. The HTML Previewer is ideal for testing these templates because what you see is what email recipients will see.

What is the difference between Prettify and Minify?

Prettify takes compressed or messy HTML and adds indentation and line breaks so the code is easy to read and edit. Each tag gets its own line with proper nesting shown through indentation. Minify does the opposite — it removes all unnecessary whitespace, line breaks, and comments to produce the smallest possible code. Minified HTML loads faster and is useful when pasting into systems with character limits.

How does the responsive preview work?

The responsive toggle simulates three screen widths: Desktop (full width of your browser), Tablet (768px, matching an iPad in portrait mode), and Mobile (375px, matching an iPhone). The preview iframe resizes to these widths so you can see how your HTML reflows. This is critical for testing email templates and responsive layouts that use media queries, percentage widths, or CSS grid and flexbox.

Can I test HTML email templates in this previewer?

Yes, this is one of the primary use cases. Paste your email HTML and it renders exactly as an email client would display it. Use the responsive toggle to check how the email looks on desktop and mobile. The starter templates include an email template with a header, call-to-action button, and footer that you can customize. Remember to use inline styles, table-based layouts for Outlook compatibility, and explicit widths for images.

What are common HTML mistakes to watch for?

The most frequent issues are: unclosed tags (every opening tag like div needs a closing /div), mismatched nesting (closing tags in the wrong order), missing quotes on attribute values, using single quotes inconsistently, forgetting alt attributes on images, and using deprecated tags like font or center instead of CSS. The element counter in the stats bar can help you verify your tag count matches expectations.

How do I make a table in HTML?

A basic table uses the table element as the container, thead for the header row, tbody for data rows, tr for each row, th for header cells, and td for data cells. Style with border-collapse: collapse on the table element, and add padding and borders to th and td cells. For email-safe tables, use explicit widths, cellpadding, cellspacing attributes, and inline styles. The Data Table starter template demonstrates a well-structured, styled table.

Is my HTML data sent to any server?

No. Everything happens in your browser. Your HTML is rendered in a sandboxed iframe on the page and never transmitted anywhere. The templates are loaded from our database, but the HTML you type or paste stays entirely on your device. You can use this tool with confidential content, proprietary code, or sensitive data without concern.