HTML Viewer screenshot

HTML Viewer

Explore an HTML document as a collapsible tree: elements, attributes and text, with the JSON kept for Copy.

Privacy First
0 Runs
Updated 2026-11-06
No upload
Instant
No signup

What the HTML viewer shows

The document is parsed the way a browser would read it for the two rules that change most documents: void elements never open a block, and an optional end tag closes implicitly, so onetwo is two items rather than one nested twice. Repeated siblings become an array, attributes are collected under @attrs and text under #text. It does not apply foster parenting or imply a , so a table is shown where you put it. Copy and Download give you the JSON.

How to use it

HTML Viewer: paste the HTML into the box above, and press Run to get the tree below.

Worked example

Input:

<!DOCTYPE html>
<nav id="top">
  <a href="/tools/json-formatter">JSON Formatter</a>
  <a href="/tools/xml-viewer">XML Viewer</a>
</nav>
<main>
  <h1>AllTools</h1>
  <p>Browser tools, <strong>no upload</strong>.</p>
  <ul><li>JSON</li><li>XML</li><li>HTML</li></ul>
  <!-- generated -->
</main>

Output:

{
  "nav": {
    "@attrs": {
      "id": "top"
    },
    "a": [
      {
        "@attrs": {
          "href": "/tools/json-formatter"
        },
        "#text": "JSON Formatter"
      },
      {
        "@attrs": {
          "href": "/tools/xml-viewer"
        },
        "#text": "XML Viewer"
      }
    ]
  },
  "main": {
    "h1": "AllTools",
    "p": {
      "strong": "no upload",
      "#text": "Browser tools, ."
    },
    "ul": {
      "li": [
        "JSON",
        "XML",
        "HTML"
      ]
    },
    "#comment": " generated "
  },
  "#doctype": "<!DOCTYPE html>"
}

Why it runs in your browser

The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads HTML and returns tree; reloading the page discards both.

The document is parsed the way a browser would read it for the two rules that change most documents: void elements never open a block, and an optional end tag closes implicitly, so <li>one<li>two is two items rather than one nested twice. Repeated siblings become an array, attributes are collected under @attrs and text under #text. It does not apply foster parenting or imply a <tbody>, so a table is shown where you put it. Copy and Download give you the JSON.

Explore an HTML document as a collapsible tree: elements, attributes and text, with the JSON kept for Copy.

How to use it

HTML Viewer: paste the HTML into the box above, and press Run to get the tree below.

Why it runs in your browser

The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads HTML and returns tree; reloading the page discards both.

What to Expect

Best for

  • Converting HTML to tree when the data is already on screen.

What this tool keeps

  • Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.

Sample input

<!DOCTYPE html> <nav id="top"> <a href="/tools/json-formatter">JSON Formatter</a> <a href="/tools/xml-viewer">XML Viewer</a> </nav> <main> <h1>AllTools</h1> <p>Browser tools, <strong>no upload</strong>.</p> <ul><li>JSON</li><li>XML</li><li>HTML</li></ul> <!-- generated --> </main>

Sample output

{ "nav": { "@attrs": { "id": "top" }, "a": [ { "@attrs": { "href": "/tools/json-formatter" }, "#text": "JSON Formatter" }, { "@attrs": { "href": "/tools/xml-viewer" }, "#text": "XML Viewer" } ] }, "main": { "h1": "AllTools", "p": { "strong": "no upload", "#text": "Browser tools, ." }, "ul": { "li": [ "JSON", "XML", "HTML" ] }, "#comment": " generated " }, "#doctype": "<!DOCTYPE html>" }

Frequently asked questions

How do I use the html viewer?

HTML Viewer: paste the HTML into the box above, and press Run to get the tree below.

Is my input uploaded?

No. The text is parsed on this page with JavaScript and is never posted to a server.

Is there a size limit?

Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.