X Xerobit

HTML Viewer & Formatter

Paste HTML on the left and see the rendered page on the right as you type. One click formats and beautifies the code — including inline CSS and JavaScript. Check the layout at desktop, tablet and mobile widths, open a local .html file, and download the result. The preview runs in a locked-down sandbox, and nothing is uploaded.

Live preview
Paste HTML or open a file to preview it.

How to view HTML online

  1. Paste your code into the editor, or click Open file to load an .html file from your computer.
  2. Watch the preview. It updates a moment after you stop typing — no Run button needed.
  3. Check other screen sizes with the Tablet (768 px) and Mobile (375 px) buttons.
  4. Tidy the markup with Format HTML, then copy it or download it as a file.

It works for full documents with <!DOCTYPE html>, <head> and <style>, and for fragments like an email template, a snippet from a CMS, or the HTML of a single component.

Format and beautify HTML

Minified or machine-generated HTML is hard to read and harder to debug. Format HTML re-indents every element by nesting depth, puts block elements on their own lines, keeps inline elements like <b> and <a> inside their text, and also formats the CSS in <style> and the JavaScript in <script>. Content inside <pre> and <textarea> is left untouched, because whitespace there is meaningful. Choose 2 spaces, 4 spaces or tabs.

Before:

<div class="card"><h2>Title</h2><ul><li>One</li><li>Two</li></ul></div>

After:

<div class="card">
  <h2>Title</h2>
  <ul>
    <li>One</li>
    <li>Two</li>
  </ul>
</div>

Going the other way — shrinking HTML for production — is what the HTML Minifier is for.

Is it safe to preview untrusted HTML?

The preview is an <iframe sandbox>. By default it has no permissions at all: scripts don't run, forms can't submit, and the page can't open pop-ups or navigate this tab. That makes it safe to inspect HTML from an email, a scraped page or a bug report.

Tick Run JavaScript when you need scripts — the frame gets allow-scripts but still not allow-same-origin, so the code runs in an isolated origin and can't read this site's cookies or storage. Keep it off for HTML you don't trust.

Why aren't my images or stylesheets showing?

Relative paths such as src="img/logo.png" or href="styles.css" point to files on your computer or server, which the viewer can't see. Use absolute URLs (https://…), paste the CSS into a <style> block, or embed small images as data: URIs. Server-side code — PHP, includes, template tags like {{ name }} — also won't execute, because this is a static HTML viewer.

HTML viewer vs. browser “View Source”

View Source (Ctrl/⌘ + U) shows the code of a live page but doesn't let you edit it. Opening a saved .html file in a browser renders it but hides the code. This viewer shows both side by side and lets you edit, format and re-render instantly — handy for email templates, newsletter HTML, CMS snippets and quick prototypes.

Common uses

Keyboard and workflow tips

The editor is a plain text area, so the usual shortcuts work: Ctrl/⌘ + A to select everything, Ctrl/⌘ + Z to undo a format. Formatting is safe to run repeatedly — running it twice gives the same output. For large files, format first: indented code is far easier to scan than a single 50,000-character line.

FAQ

Is this HTML viewer free?

Yes — free with no signup, no limits and no ads covering the editor.

Is my HTML uploaded anywhere?

No. Rendering and formatting both happen in your browser. Your code is never sent to a server.

Can I open an HTML file?

Yes. Click Open file and choose any .html or .htm file up to 5 MB.

Does formatting change how the page looks?

Almost never. The formatter only adds or removes whitespace between tags. In rare cases whitespace between inline elements is visible (a space between two inline-block buttons, for example) — compare the preview before and after if layout is pixel-critical.

How do I format HTML in VS Code?

Press Shift + Alt + F (Windows/Linux) or Shift + ⌥ + F (macOS) to run the built-in formatter, or install Prettier for consistent formatting across a team.

Related tools

Part of Data & Format tools.


Written by Mian Ali Khalid. Last updated 2026-10-26.