SEO check

DOM Size: What It Means and How to Reduce It

What DOM size is, how our free report counts it, and the practical ways to bring a bloated page back under 1,500 elements.

Free to use 10 min read Updated Oct 2026

DOM size in one minute

Quick answer: DOM size is the number of HTML elements in your page once the browser has finished loading it. Our report passes a page with 1,500 elements or fewer and flags anything above that.

  • Pass: 1,500 elements or fewer.
  • Warning: 1,501 to 3,000 elements, with the same red box and button as a fail.
  • Fail: more than 3,000 elements.
  • Fix: Remove unused markup, flatten wrappers, split long pages and build heavy parts on demand.

Check my website

The report is free and needs no account, and the median mobile page has about 594 elements.

What is DOM size in SEO?

DOM stands for Document Object Model, the in-memory tree a browser builds from your HTML. The WHATWG DOM Standard defines it today, after earlier work at the W3C. Every tag becomes an element in this DOM tree, and DOM size is the element count, also called total DOM elements. People also say DOM nodes, but a node can be plain text and the check counts elements only.

View source shows what the server sent, while the rendered DOM also holds everything JavaScript added afterward: menus, widgets, banners and ads. To see how much JavaScript adds on your own page, open view-source: for its address, then compare that tag count with the Elements panel after load. The number is not file weight either, which our web page size check covers in kilobytes.

Lighthouse also reports maximum depth and the most children per parent, but our check uses the total alone.

How SEO Site Checker tests your DOM size

The Dom Size row sits in the Speed section, with a tile, a message quoting the count and, over the limit, a red How to Fix button.

The exact rule: We open your URL in headless Chromium driven by Playwright, wait for the load event (up to 20 seconds), then count every element in the document. Up to 1,500 passes. From 1,501 to 3,000 is a warning. Above 3,000 fails.

Our limits are looser than the Lighthouse guidance, so a page can pass here and still be flagged in PageSpeed Insights. Run the free report to see your own row.

What the report counts

The count covers every element in the document after the load event: html, head, body and every descendant, including meta, link, script and style tags and inline SVG parts. Running document.querySelectorAll("*").length in DevTools uses the same method, so the two agree once the page settles, though extensions can push the DevTools figure higher. Text nodes, comments, shadow DOM contents, iframe documents and late additions are not counted.

One documentation page we probed showed 806 elements at load on one run, 953 on another and 973 four seconds later, so judge trends over several tests.

What pass, warning and fail mean

  • Pass: 1,500 elements or fewer, shown as a green tile with a message that quotes your count.
  • Warning: 1,501 to 3,000 elements, shown with a yellow icon but the same red message box and How to Fix button as a fail.
  • Fail: more than 3,000 elements, shown with a red icon.
  • Not tested: maximum depth and children per parent, content built by scrolling or after the load event, interaction speed (INP) and other pages.

The overall score is passed checks divided by all checks, so a warning pulls it down exactly as far as a fail does. The page loads at a default 1280 by 720 viewport and never scrolls, so a pass says nothing about how the page responds to taps. If the row shows 0, the page could not be read, so test again.

Why our number differs from Lighthouse

Lighthouse counts only elements under the body tag, while we count the whole document, and the head adds roughly 90 elements on our own home page. The classic audit flags about 800 body elements as a warning and about 1,400 as an error, while newer versions use an Optimize DOM size insight about slow style and layout updates, as the Lighthouse DOM size documentation explains. Treat a pass here as a floor.

How many DOM elements is too many?

No single official limit exists, so compare your count with several yardsticks. The first three rows come from the markup chapter of the HTTP Archive Web Almanac, a different crawl and method from ours, so read them as context, not a pass line.

BenchmarkElementsWhat it tells you
Median mobile page594Normal, nothing to fix.
75th percentile1,010Heavier than three quarters of mobile pages. Fine for a content-rich page, though it would have drawn the old Lighthouse warning.
90th percentile1,716The heaviest tenth, worth a look.
Classic Lighthouse warning and errorAbout 800 and 1,400 body elementsStricter than our limits.
Our report1,500 pass, 3,000 failPass line, then a warning band.

Maximum DOM depth and children per parent have no numeric limit, so treat them as clues. A long chain of nested wrapper divs, or one parent with hundreds of children, marks the part to fix first.

Why DOM size matters for speed and SEO

A large DOM takes more memory and style calculations, so the first render is slower. A tap that changes the page can force style recalculation across many elements, which drags down Interaction to Next Paint (INP), as the web.dev guide to large DOMs explains.

Slow rendering lengthens your page load time and can hurt Largest Contentful Paint, both covered in our Core Web Vitals guide. A smaller tree is one lever, not a guarantee. Google has not confirmed DOM size as a ranking factor, so any effect runs through page experience and visitors leaving slow pages.

How to check your DOM size

  1. Read the report. Open the Dom Size row in the Speed section for our count.
  2. Count in the console. In Chrome, press F12, choose Console and run the first line below once the page has loaded. Paste the lines one at a time, because the console only prints the result of the last statement in a pasted block.
  3. Rank the biggest sections. The second line lists the five children of body holding the most elements. The third finds the busiest single parent, ready to inspect in the Elements panel.
  4. Open Lighthouse. PageSpeed Insights lists the DOM statistics in the Optimize DOM size insight, or in the older Avoid an excessive DOM size audit.
JavaScript
document.querySelectorAll("*").length;
[...document.body.children].map(e => [e.tagName, e.className, e.querySelectorAll("*").length]).sort((a, b) => b[2] - a[2]).slice(0, 5);
[...document.querySelectorAll("*")].reduce((a, b) => (b.children.length > a.children.length ? b : a));

How to reduce DOM size, step by step

Work in this order and re-run the report after each change.

1. Find the heavy parts first

Run the ranking line from the check section, then repeat it inside the biggest block by swapping document.body for that element. Two rounds usually land on a mega menu, slider, related posts widget, comment section or product grid. Start with whatever your template repeats, since one fix there lowers every page.

2. Remove what nobody uses

Many themes ship one menu for desktops and another for phones, hiding one with CSS, so every link appears twice. Keep one and restyle it. Then scan the Elements panel for modals, cookie banners and tab panels hidden in the HTML on every load, and delete any you never open. Hiding them with display: none does not lower the count, so the markup has to go.

3. Flatten the markup

Replace stacked wrapper layers with one container that uses CSS Grid or Flexbox. Paste into editors as plain text so no junk spans come along.

HTML
<!-- Before: three wrappers per link -->
<div class="row"><div class="col"><div class="card-wrap"><a href="/tools/">Tools</a></div></div></div>
<div class="row"><div class="col"><div class="card-wrap"><a href="/blog/">Blog</a></div></div></div>

<!-- After: one container -->
<div class="cards"><a href="/tools/">Tools</a><a href="/blog/">Blog</a></div>
CSS
.cards { display: grid; gap: 16px; }

4. Split or paginate long pages

Show 24 to 48 items per listing page, or split a one page site into separate URLs. Use normal a href pagination links so crawlers can follow.

5. Build heavy parts only on demand

Keep tab, accordion and modal markup in a template element, fetch it on click, or use a Load more button. The Intersection Observer API can build a section as it nears the viewport. Nodes added after load escape our count but still weigh on visitors.

Defer only what does not need to rank, such as a size guide, a shipping calculator or a newsletter modal. Googlebot does not click buttons, so text that exists only after a click is not indexed. Keep reviews, product copy and anything else you want found in the initial page.

HTML
<template id="size-guide-tpl"><section>...size chart...</section></template>
<button type="button" id="show-size-guide">Open size guide</button>
JavaScript
document.getElementById("show-size-guide").onclick = e => e.target.replaceWith(document.getElementById("size-guide-tpl").content.cloneNode(true));

6. Trim third party widgets

Chat, reviews, social feeds, ad slots, consent banners and tags loaded through Google Tag Manager can inject a lot of markup on every page. Load them on interaction, for example a Chat button that fetches the script only after a click. Heavy scripts add main thread work as well, which our JavaScript execution time guide covers.

How to reduce DOM size in WordPress, Shopify and JavaScript apps

On WordPress, page builders such as Elementor, WPBakery and Divi add wrapper containers, so choose lighter markup or a simpler theme, and disable plugins one at a time while re-running the report. Limit posts per page under Settings, Reading, and paginate comments under Settings, Discussion. Our WordPress theme detector names the theme behind a heavy page.

On Shopify, remove unused sections and app blocks and use the Liquid paginate tag on collections. In React, Next.js, Angular and Vue apps, window long lists (for example with react-window), use fragments, and render modals only when open. On hosted builders such as Wix and Squarespace you usually cannot edit the generated markup, so cut sections or pick a simpler template.

Common mistakes when cutting DOM size

Hiding is not removing: display: none and visibility: hidden leave every element in the DOM and in our count. The content-visibility property from CSS Containment skips off screen render work but keeps the elements, as MDN Web Docs notes.

Infinite scroll that never removes old items grows the tree with every scroll, so a feed can pass 3,000 elements and turn sluggish. Recycle items that have scrolled out of view.

Minifying with the HTML Minifier shrinks the bytes sent, but the tree keeps the same elements. Deleting content that earns traffic is the last mistake, so paginate it instead.

How to Fix

The short version, the same steps you see when you click How to Fix in your report.

Why this fails: After loading, your page holds more than 1,500 HTML elements (a warning up to 3,000, a fail above that). Every element costs the browser memory plus style and layout work, so big pages render and respond slowly.

How to fix it:

  1. Find the heavy parts. Open DevTools with F12, choose Console, and run the three lines below one at a time after the page loads, because the console only prints the result of the last statement in a pasted block. They give the total, the sections ranked by element count, and the element with the most direct children. Usual suspects are builder sections, mega menus, sliders, related posts, comments, product grids and chat widgets.
  2. Remove unused sections, widgets, plugins and hidden blocks.
  3. Flatten stacked wrapper divs into one CSS Grid or Flexbox container.
  4. Paginate or split long lists and long pages, and keep normal links between the parts.
  5. Build tabs, modals and long lists only when needed, using a template element, a Load more button or list windowing. Keep content you want indexed in the page, because search crawlers do not click.
  6. Load chat, review and social widgets on interaction instead of at page load.
JavaScript
document.querySelectorAll("*").length;
[...document.body.children].map(e => [e.tagName, e.className, e.querySelectorAll("*").length]).sort((a, b) => b[2] - a[2]).slice(0, 5);
[...document.querySelectorAll("*")].reduce((a, b) => (b.children.length > a.children.length ? b : a));
  • WordPress: Disable plugins one at a time, use lighter builder markup, and paginate posts and comments.
  • Shopify: Remove unused sections and apps, and use the Liquid paginate tag.
  • React and similar apps: Window long lists, use fragments, and render modals only when open.
  • Wix and Squarespace: Delete sections and repeating blocks, or choose a simpler template.

What does not help: display: none, visibility: hidden, content-visibility and HTML minifying all keep the elements, so the count stays the same. See the web.dev guide to large DOMs.

Re-test: Run our free report again and expect 1,500 elements or fewer in the Dom Size row. In Chrome DevTools the same count is document.querySelectorAll("*").length once the page has loaded.

Re-test my website

Frequently Asked Questions

What is DOM size in SEO?
It is the number of HTML elements in the rendered page after loading. It matters mainly through speed and interaction quality, which feed page experience. Our report flags pages above 1,500 elements.
How many DOM elements is too many?
Our report warns above 1,500 elements and fails above 3,000. The classic Lighthouse audit flags about 800 and 1,400 body elements, and the median mobile page has about 594, so aim well under 1,500 for phone visitors.
How do I check DOM size in Chrome?
Open DevTools, choose Console and run document.querySelectorAll('*').length after the page has loaded. It can differ slightly from our report, which reads the count at the load event. PageSpeed Insights also lists total elements.
Does DOM size affect SEO rankings?
No direct ranking signal has been confirmed. A huge DOM can slow rendering and hurt interaction speed, which feeds page experience and can make visitors leave, so any effect on rankings is indirect.
What causes an excessive DOM size?
The usual causes are page builders that wrap sections in extra containers, plugin widgets, mega menus, long lists and galleries, third party scripts that inject markup, pasted editor markup and forgotten hidden blocks.
How do I reduce DOM size in WordPress?
Disable plugins one at a time and re-run the report to find the heavy one. Then use lighter builder markup or a simpler theme, limit posts per archive page, paginate comments and remove unused widgets.
Will fixing DOM size improve my PageSpeed score?
It can help rendering and interaction metrics when the DOM was very large, but no gain is guaranteed. Lighthouse 13 shows the audit as an Optimize DOM size insight about slow style and layout work, not a fixed count.
Does hiding elements with display none reduce DOM size?
No. Hidden elements stay in the DOM and in the count, so the number does not move. Remove the markup itself, or create it only when a visitor opens that part, as long as it does not need to rank.

See how your site scores right now

Paste your address into the free report, then use the How to Fix button on anything that needs work.

Free to use. Results in under a minute for most sites.