---
title: "HTML Viewer Online: Safe Preview and Format HTML | Prettify"
description: "Open an HTML file online in a safe preview: scripts never run and
  remote images stay blocked. Format HTML with Prettier. Free, in your browser,
  no upload."
url: https://prettify.tools/html-viewer
---

# HTML Viewer Online

Paste a saved web page, an email template, or an exported report and see it as a page, without the risk of opening it in a browser tab. The Prettify Preview draws the HTML in a sandbox where scripts never run and remote images stay blocked. The source is one click away, and Prettier formats it when you ask.

## What the HTML viewer does

An HTML file from an unknown source can do more than show text. When you open it in a browser tab, its scripts run, it loads files from other servers, and a remote image can tell its server that you opened the page. The Prettify Preview shows the same page without those side effects.

The box on this page shows the source you paste, counts its lines, and notes what the Preview will leave out, such as scripts and links to external files. The page on this site never draws your HTML. Select "Open in Preview" to see it drawn in the editor.

## What the Preview blocks

The Preview draws the page in a sandboxed frame. The frame has no access to the storage or the data of Prettify. These rules apply to every page you open:

- Scripts never run. A page that draws its content with scripts can look different from the same page in a browser.
- The page makes no network requests. The one exception is images, after you select Load remote images.
- Links to other pages do nothing. Links to a place in the same page, such as #section, scroll the page.
- Audio and video do not play, and a frame inside the page shows nothing.
- A notice tells you when the page has scripts, and another tells you when remote images are blocked.

## Key features

The viewer has three views. Preview draws the page. Raw shows the source as plain text. Both shows the source and the Preview side by side, and the Preview reloads after you stop typing.

- Format document runs Prettier on the page. The text of style and script elements stays as you wrote it, and whitespace that changes how the page looks stays in place.
- Every data: URI stays byte for byte. If Prettier cannot format the page, or would lose a URI, the text does not change and Prettify shows an error.
- In the Raw view, a data: URI of 1 KB or more shows as a short chip, such as data:image/webp · 312 KB. Select a chip to copy the full URI.
- Prettify does not format HTML when you paste or open it. Copy and Download write the exact source.
- The Problems panel notes scripts that do not run and external files that the Preview cannot load.

## How to view an HTML file

Prettify detects HTML when the text starts with \<!doctype html or \<html. A file with the .html or .htm extension is always HTML. The box reads documents up to 512 KB; a larger page goes straight to the editor.

1. Paste your HTML into the box labeled "Paste your HTML", or select "Try an example".
2. Read the line above the result. It counts the lines and notes any scripts or external files.
3. Select "Open in Preview" to see the page drawn in the sandbox.
4. If the page needs its remote images, select Load remote images. The choice applies to this document only.
5. To clean up the source, select Format in the toolbar, or press Cmd+K and run Format document.
6. Select Download to save the page as a .html file.

## Worked example: an email template with a tracking pixel

The template below has a logo stored as a data: URI, a remote image of one pixel, and a script. In a browser, the remote image loads from the sender server and tells it that you opened the mail.

In the Preview, the logo shows, because a data: URI is part of the page. The pixel does not load, and the notice "Remote images are blocked." appears. The script does not run, and the box on this page notes "This page has 1 script. It does not run in the preview." The Problems panel in the editor lists the same notes.

```
<!doctype html>
<html>
  <body>
    <img src="data:image/png;base64,iVBORw0KGgo..." alt="Logo">
    <h1>Your order has shipped</h1>
    <p>Track it from your account page.</p>
    <img src="https://mail.example.com/open?id=8841" width="1" height="1">
    <script>trackOpen()</script>
  </body>
</html>
```

## Common uses

Single-file HTML is everywhere: AI tools write reports with inline styles and images, and email and test tools export pages that a text editor cannot read well.

- Read an exported report or a test result page without running its scripts.
- Check an email template before you send it, and see which images come from remote servers.
- Open a saved web page from someone else and look at it before you open it in a browser.
- Format a minified page so you can read its structure and find a tag.
- Edit a page that holds large base64 images without the text editor slowing down.

## What is free, what is Pro, and where your HTML goes

The Preview, the Raw view, and Format document are free. The side by side view, named HTML Side by Side, is part of Pro. Pro costs US$19.99 once, with lifetime access and no subscription.

Your HTML stays on your device. Prettify does not upload it unless you create a share link. A page over 5 MB opens and edits as normal, but Prettify does not keep History versions for it.

## Frequently asked questions

### Is it safe to open an HTML file from someone I do not know?

The Preview is built for that. Scripts never run, the page makes no network requests unless you load remote images, and the frame cannot read the data of Prettify. Links to other pages do nothing.

### Why does the page look different from the page in my browser?

Scripts do not run in the Preview, so content that a script draws does not appear. Remote images and style sheets from other servers do not load either. The Problems panel lists what the Preview left out.

### Can I see an HTML fragment, such as one div?

Yes. A fragment is not a full page, so Prettify reads it as XML at first. Pick HTML in the format list to get an empty HTML tab, then paste the fragment into that tab.

### Does formatting change my inline CSS or JavaScript?

No. Prettier formats the markup, but the text of style and script elements stays as you wrote it. Whitespace that changes the layout and every data: URI also stay the same.

### Is the HTML viewer free?

Yes. The Preview, the Raw view, formatting, and Download are free and need no account. Only the side by side view is Pro.

## Related tools

- [SVG Viewer Online](https://prettify.tools/svg-viewer)
- [Markdown Preview](https://prettify.tools/markdown-preview)
- [Online Markdown Editor](https://prettify.tools/markdown-editor)
- [Markdown Formatter](https://prettify.tools/markdown-formatter)
- [XML Formatter: Prettify and Pretty-Print XML](https://prettify.tools/xml-formatter)
- [XML Viewer Online](https://prettify.tools/xml-viewer)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Prettify",
  "url": "https://prettify.tools",
  "description": "Multi-format data viewer, editor, and query engine for JSON, YAML, CSV, XML, Mermaid, Markdown, MDX, HTML, and SVG",
  "applicationCategory": "DeveloperApplication",
  "operatingSystem": "Web, macOS, Windows, Linux",
  "offers": [
    {
      "@type": "Offer",
      "price": "0",
      "priceCurrency": "USD",
      "description": "Free tier with core features"
    },
    {
      "@type": "Offer",
      "price": "19.99",
      "priceCurrency": "USD",
      "description": "Pro: lifetime access to all features"
    }
  ],
  "publisher": {
    "@id": "https://prettify.tools/#organization"
  }
}
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://prettify.tools/#organization",
  "name": "Prettify",
  "legalName": "Off Leash Labs",
  "url": "https://prettify.tools/",
  "logo": {
    "@type": "ImageObject",
    "url": "https://prettify.tools/icon-512.png",
    "width": 512,
    "height": 512
  },
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer support",
    "email": "offleashlabs@gmail.com",
    "availableLanguage": "English"
  }
}
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "WebPage",
      "@id": "https://prettify.tools/html-viewer",
      "url": "https://prettify.tools/html-viewer",
      "name": "HTML Viewer Online: Safe Preview and Format HTML | Prettify",
      "description": "Open an HTML file online in a safe preview: scripts never run and remote images stay blocked. Format HTML with Prettier. Free, in your browser, no upload.",
      "isPartOf": {
        "@type": "WebSite",
        "name": "Prettify",
        "url": "https://prettify.tools"
      }
    },
    {
      "@type": "FAQPage",
      "mainEntity": [
        {
          "@type": "Question",
          "name": "Is it safe to open an HTML file from someone I do not know?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "The Preview is built for that. Scripts never run, the page makes no network requests unless you load remote images, and the frame cannot read the data of Prettify. Links to other pages do nothing."
          }
        },
        {
          "@type": "Question",
          "name": "Why does the page look different from the page in my browser?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Scripts do not run in the Preview, so content that a script draws does not appear. Remote images and style sheets from other servers do not load either. The Problems panel lists what the Preview left out."
          }
        },
        {
          "@type": "Question",
          "name": "Can I see an HTML fragment, such as one div?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Yes. A fragment is not a full page, so Prettify reads it as XML at first. Pick HTML in the format list to get an empty HTML tab, then paste the fragment into that tab."
          }
        },
        {
          "@type": "Question",
          "name": "Does formatting change my inline CSS or JavaScript?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "No. Prettier formats the markup, but the text of style and script elements stays as you wrote it. Whitespace that changes the layout and every data: URI also stay the same."
          }
        },
        {
          "@type": "Question",
          "name": "Is the HTML viewer free?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Yes. The Preview, the Raw view, formatting, and Download are free and need no account. Only the side by side view is Pro."
          }
        }
      ]
    }
  ]
}
```
