FormatterHQ

HTML Viewer

Paste HTML code or open an .html file and see the rendered page instantly. The preview runs in an isolated sandbox, so unknown files are safe to inspect.

Input HTML
Output HTML
Ready.

How to use the HTML Viewer

  1. Paste HTML into the editor or open an .html or .htm file from your computer.
  2. The rendered result appears in the preview pane as you type.
  3. Use the fullscreen button to inspect the page at a larger size.
  4. Edit the code to experiment, then copy or download the updated HTML.

See what HTML code really looks like

Reading raw HTML is hard: nested tags, inline styles and long attribute lists hide what the page actually shows. This HTML viewer renders your code the way a browser does, right next to the source. It is useful for checking a snippet from documentation, opening an HTML attachment, previewing an email template or looking at a saved web page without launching a local server.

What you can view

  • Complete documents with <!DOCTYPE html>, <head>, embedded <style> blocks and scripts.
  • Fragments such as a single table, form or card component.
  • HTML email templates, which rely on inline styles and tables. The preview shows how a standards-based browser renders them (email clients such as Outlook may still differ).
  • Exported reports from test runners, coverage tools or analytics exports that produce stand-alone HTML files.

How the sandbox protects you

The preview is an <iframe> with the sandbox attribute and a unique, opaque origin. Scripts in your HTML can run, so interactive demos work, but they:

  • cannot read or change this website, its cookies or its storage;
  • cannot access localStorage, sessionStorage or cookies of their own (these throw errors in an opaque origin);
  • cannot navigate the main window away from the page.

That makes it reasonably safe to open HTML files you received from someone else and want to inspect before opening them directly in your browser.

Why something might look different

  • Relative paths – <img src="images/logo.png"> or <link href="style.css"> refer to files next to the original document, which the viewer does not have. Use absolute URLs or embed small images as data URIs with the image to Base64 tool.
  • Blocked resources – some external fonts, scripts or APIs refuse to load inside an iframe or from a sandboxed origin.
  • Storage-dependent scripts – code that relies on cookies or localStorage fails in the sandbox; test it on a local web server instead.
  • Fonts – web fonts load only if the document links to them with a full URL; otherwise the browser falls back to a default font.

Viewing HTML emails

Email templates are a special case. They are usually built with nested tables and inline styles because many email clients ignore modern CSS. The viewer shows how a standards-compliant browser renders the template, which is a good first check for broken tables, missing images and typos. Always send a test message to real inboxes too, since desktop mail programs apply their own rendering rules.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <style>
    body { font-family: system-ui, sans-serif; padding: 2rem; }
    .badge { background: #2563eb; color: #fff; padding: .25rem .6rem; border-radius: 999px; }
  </style>
</head>
<body>
  <h1>Hello <span class="badge">new</span></h1>
  <button onclick="this.textContent = 'Clicked!'">Click me</button>
</body>
</html>

Paste this and you see a styled heading with a blue badge and a working button.

Next steps

If the source is hard to read, tidy it with the HTML formatter. Check it for markup errors with the HTML validator. When you want to build a page rather than just look at one, the online HTML editor is set up for writing and downloading complete documents.

The HTML is rendered locally in your browser and is not uploaded or stored.

Frequently asked questions

Is it safe to open an unknown HTML file here?
The preview runs in a sandboxed iframe with its own opaque origin, so scripts cannot access this site, your cookies or other tabs. For files you do not trust at all, still avoid entering personal data into any forms they contain.
Why are images or stylesheets missing?
Relative paths point to files stored next to the original HTML document, which the viewer cannot see. Use absolute URLs or embed images as data URIs.
Does JavaScript run in the preview?
Yes, scripts run inside the sandbox, so buttons and interactive demos work. Features that need cookies or localStorage are blocked because the sandbox has no persistent origin.
Can I view the source of a live website?
Copy the page source from your browser (usually with a View Source command) and paste it here. Relative links and assets from that site may not load.
Is my HTML uploaded?
No. The code is rendered by your own browser and is not sent to a server unless you press Save & Share to create a link to it.

Last updated September 27, 2026

Related tools

BBCode Viewer Preview BBCode forum posts before publishing: bold, colours, links, quotes, lists, code and spoilers rendered live. CSV Viewer View CSV files as a clean, sortable-looking table in your browser. Auto-detects commas, semicolons, pipes and tabs. Excel Viewer Open and view Excel (.xlsx, .xls), OpenDocument (.ods) and CSV spreadsheets online without Excel. Sheet tabs, merged cells and JSON tree. EXIF Viewer Read EXIF, GPS, XMP, IPTC and ICC metadata from photos — camera, lens, exposure, date and location — without uploading the file. JSON Viewer & Beautifier View JSON as a collapsible tree and beautify it at the same time. Explore nested objects and arrays without losing your place. Markdown Viewer View Markdown files rendered like on GitHub: open a .md file or paste text and see formatted headings, tables and code. LaTeX Math Renderer Render LaTeX math equations with KaTeX in a live preview and copy the MathML or HTML to use in web pages. Line Graph Maker Create line graphs online from CSV or JSON data. Multiple series, axis labels, custom colours and free SVG download. Mermaid Live Editor Write Mermaid flowcharts, sequence, class, ER, Gantt and state diagrams with a live preview, then export SVG or PNG. MP3 & Audio Metadata Viewer Read the ID3 tags and metadata of MP3, FLAC, M4A, Ogg, WAV and other audio files: title, artist, album, cover art, bitrate and duration. Word, Excel & PowerPoint Metadata Remover Remove author, last editor, company, editing time, custom properties and reviewer names from Word, Excel and PowerPoint files. No upload. Word, Excel & PowerPoint Metadata Viewer See the hidden metadata in .docx, .xlsx and .pptx files: author, last editor, editing time, comment authors, tracked changes and more.