DOM Complexity Analyzer

Paste the page markup and see how many elements it has, how deep it goes, which parent has the most children, where wrapper divs pile up, and how two versions compare.

Draait in je browser. Je bestanden verlaten je apparaat nooit. Zie hoe je dit controleert

…

Zo doe je het

  1. 1
    Get the markup

    Copy the outerHTML of the html element from DevTools, or the page source.

  2. 2
    Paste it

    Paste into the Page HTML box or open a saved HTML file.

  3. 3
    Read the summary

    Check elements, depth and widest parent against the limits.

  4. 4
    Find hotspots

    Use the depth chart, tag table and wrapper chain list to see where nodes pile up.

  5. 5
    Browse the tree

    Collapse to level 2 and expand the sections with the most descendants.

  6. 6
    Compare and export

    Paste a second version in Compare and export the metrics as CSV.

Over deze tool

A large DOM costs memory, makes style calculation and layout slower, and stretches every interaction, which shows up in Interaction to Next Paint. Lighthouse warns when a page has more than 800 elements in the body and fails it above 1,400, and it also reports the deepest element and the parent with the most children, with 32 levels and 60 children as rough limits. This analyzer gives you those numbers for any HTML you paste, without running Lighthouse, and adds the detail you need to act. It parses the markup with a forgiving parser, counts elements and text nodes, records the depth of every element, finds the deepest branch and prints its full path with ids and classes, and finds the widest parent. It also lists the most used tags, the number of elements at each depth level, inline style attributes, inline SVG elements, duplicate ids, empty divs and wrapper chains, which are runs of four or more divs or spans that each contain only one other div or span. A collapsible tree shows the whole structure with the number of descendants at each node.

Finding what to cut

Start with the depth chart and the tag table. A big spike at one level usually means a long list of repeated cards or rows; paginate it, render more on scroll, or use content-visibility: auto so the browser skips layout for parts off screen. Wrapper chains come from components that each add their own container; collapsing a four-level chain into one element in a card that repeats 40 times removes 120 elements. Inline SVG icons repeated in every card add many nodes; an SVG sprite with use elements or img tags is lighter. Mega menus and hidden tabs rendered up front are another common source.

Compare two pages

The compare tab takes a second page, such as the same template after a refactor or a competitor's equivalent page, and shows each metric side by side with the change and percentage. Red means more, green means fewer.

Getting the right HTML

View source shows the HTML the server sent. Pages built in the browser by JavaScript have a different, usually larger, DOM. For those, open DevTools, right-click the html element, choose Copy and then Copy outerHTML, and paste that.

Limits

The parser closes tags the way browsers mostly do, but it is not a full HTML5 parser, so badly broken markup can be counted slightly differently from Chrome. Shadow DOM contents and iframes are not counted. The limits are Lighthouse guidance, not hard rules, and a small DOM does not guarantee fast interactions.

Uitgewerkt voorbeeld

The sample shop page has 503 elements, a maximum depth of 9 and 40 children under the product grid section, all within limits. The tool still finds 40 wrapper chains, one in every product card: card-wrap, card, card-inner and card-body each hold only one child. The id top is used twice, on the header and the footer, and is reported as a duplicate. Collapsing each chain into a single element would remove 3 elements per card, or 120 in total, cutting the page to 383 elements. Pasting the refactored page into the compare tab confirms 383 elements and a depth of 6.

In het kort

Veelgestelde vragen

How many DOM elements are too many?

Lighthouse warns above 800 body elements and fails above 1,400. Pages can work above that, but style, layout and interaction costs grow with size.

Why is my count different from Lighthouse?

Lighthouse counts the live DOM after scripts run. If you pasted view-source HTML, scripts may add or remove many elements; paste the outerHTML from DevTools to match.

What is a wrapper chain?

A run of four or more div or span elements where each holds exactly one other div or span and no text. They add depth and nodes without adding meaning.

Does content-visibility reduce the DOM size?

No. The elements still exist, but the browser can skip their layout and paint while off screen, which reduces much of the cost.

Are SVG elements counted?

Yes, every element inside inline SVG counts, and the tool reports the total separately so icon-heavy pages stand out.

Is my HTML stored?

Only in local storage in your browser, so undo survives a reload. It is never uploaded.

Helemaal gratisGeen kosten, geen registratie
Bestanden blijven privéAlles draait in je browser
Makkelijk in je eigen taalBeschikbaar in veel talen