Code Tools

DOM Visualizer

All tools

Print the element tree the browser builds from your markup, so misplaced nesting is obvious.

How it works

Four simple steps

1

Paste markup

Add the snippet whose structure you want to check.

2

Browser parses it

The real HTML parser applies its usual corrections.

3

Read the outline

Elements and short text nodes are indented by depth.

4

Compare to source

Spot where the parsed tree differs from what you wrote.

DOM Visualizer

About DOM Visualizer

Your markup puts a <div> inside a <p>, and the page renders strangely. The browser quietly restructured it, but reading the source will not show you how. An outline of the parsed tree does.

The visualizer hands your HTML to the browser's parser and prints the resulting body as an outline. Each element appears as its tag name in angle brackets, indented two spaces per level, and each non-empty text node appears in quotes, trimmed and cut to 40 characters. Attributes and comments are left out to keep the outline short. The tree refreshes on every edit and can be copied or downloaded.

The value is in seeing the parser's corrections. A <div> inside a <p> closes the paragraph early, stray table content is moved out of the table, and missing closing tags are filled in. Compare the outline with your source to find where the two disagree. Only the contents of body are shown, so title and meta tags that belong in head do not appear. For a list of unbalanced tags in the source itself, use the HTML structure validator, and to keep attributes in the output, serialize it to JSON with attributes. The HTML indenter shows your source with its original nesting for comparison.

The outline comes from a detached document created with DOMParser in this tab, so nothing is rendered, executed or uploaded.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

The browser applies the HTML parsing rules before the tree is printed. Invalid nesting is corrected, implied tags are added and some elements are moved. The outline shows the corrected version, which is what CSS and JavaScript actually see.

Not in this view; only tag names and text are shown. HTML to JSON lists every attribute for each element.

Text is truncated to 40 characters so the outline stays readable. The full text is still in your source; the tree is meant for structure rather than content.

View more FAQs

Related tools

View all

HTML Formatter

Beautify and indent HTML markup.

Open

CSS Formatter

Format and pretty-print CSS.

Open

JS Formatter

Beautify JavaScript code.

Open

JSON Formatter

Beautify and validate JSON.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools