How to fix "Avoid an excessive DOM size"
An excessive DOM size means a page is built from too many HTML elements, which makes it slower to load, display and respond to taps and clicks. You fix it by removing or simplifying page sections, not by tweaking a single setting.
If a speed test told you to "avoid an excessive DOM size", it is saying your page is made of too many building blocks. Nothing is broken, but the browser has more work to do than it should. This page explains the warning in plain English, how to see how big your pages are, and what to change to bring the number down.
What an excessive DOM size is
Every page is built from HTML elements: headings, paragraphs, images, buttons, menus and the invisible boxes (usually div elements) that arrange them. The browser reads these and builds a tree of them in memory. That tree is the DOM (Document Object Model). The more elements the page has, and the more deeply they are nested inside each other, the bigger the tree.
Google's Lighthouse test has long used these rough limits: a warning when a page has more than about 800 elements, and a failure above about 1,400. It also looks at how deep the nesting goes and how many child elements sit under one parent. Exact numbers and wording vary between Lighthouse versions, so treat them as a guide rather than a hard line.
What people usually notice:
- Pages that feel heavy on phones, especially older or cheaper ones
- Menus, filters or buttons that react slowly when tapped
- Long pages that stutter while scrolling
- A score or warning in PageSpeed Insights or Lighthouse
Why it matters
A large DOM costs time at three points. The browser needs longer to build the page, longer to work out where everything goes, and longer to redraw it whenever something changes. On a fast laptop you may not feel it. On a mid-range phone you probably will.
This connects to Core Web Vitals, the speed and responsiveness measures Google reports on. A bloated page can delay the main content appearing and make interactions laggy (see poor INP). Slow pages are also less pleasant to use, and visitors who wait tend to leave, which hurts enquiries and sales. The DOM warning is rarely the biggest speed problem on its own, but it is often a sign of how the page was built.
How to check your site
You can do all of this for free.
- Open PageSpeed Insights and test a page. Look for "Avoid an excessive DOM size" or a "DOM size" item under diagnostics. It shows the total number of elements, the deepest nesting and the parent with the most children.
- In Chrome, right click the page, choose Inspect, open the Lighthouse tab and run a report. The result is the same, and it works on pages that are not public yet.
- For a quick count, open the Console tab in Chrome's developer tools, type
document.querySelectorAll('*').lengthand press Enter. That is the number of elements on the page.
Test more than the home page. Long blog posts, category pages, product listings and pages with big tables or many sliders are the usual offenders. Test on the mobile setting, since that is how Google scores most pages.
How to fix it
The goal is fewer and simpler elements. These changes help on any platform, roughly in order of payoff.
- Shorten long pages. Split a huge page into several, or show 12 to 24 items with pagination or a "load more" button instead of hundreds at once.
- Remove what nobody uses. Hidden pop-ups, old sliders, duplicate mobile and desktop menus, unused tabs and accordions all still add elements even when you cannot see them.
- Flatten the layout. Page builders often wrap each item in several nested sections, rows, columns and containers. Use fewer wrappers and let one container do the job of three.
- Simplify mega menus. A menu with hundreds of links loaded on every page is a common cause. Cut it down to the important links.
- Trim big tables and lists. Move rarely needed detail to its own page or a downloadable file.
- Reduce widgets and embeds. Social feeds, review widgets, chat tools and comment systems can each add a large number of elements. Keep only what earns its place.
- Load heavy parts later. A developer can render below-the-fold sections only when the visitor scrolls to them.
Platform notes (menu names depend on your version and theme):
| Platform | Where to look |
|---|---|
| WordPress | Theme and page builder layouts, plugins that inject widgets, menus and sliders. See the WordPress guide. |
| Elementor | Nested sections and containers, repeated inner sections, heavy widgets. See the Elementor guide. |
| Shopify | Theme sections, apps that add blocks, large collection pages. See the Shopify guide. |
| WooCommerce | Product grids, filters, mini carts and related product blocks. See the WooCommerce guide. |
| Wix, Webflow, Squarespace | Strips, sections and animations; see the guides for Wix, Webflow and Squarespace. |
On hosted builders you cannot change the underlying code, so the fix is almost always to use fewer sections, fewer effects and shorter pages. If a plugin or app adds a lot of markup, disabling it on pages that do not need it often makes a real difference. Make a backup before you change a live site, and change one thing at a time so you can see what helped.
How to confirm the fix worked
Run the same page through PageSpeed Insights again, on the same device setting, and compare the element count, depth and largest parent with your earlier numbers. The Console command above gives a quick before and after. Do not expect a perfect score: the aim is a clear drop and a page that feels quicker on a real phone.
Also click through the page yourself. Check that menus, tabs, forms and checkout still work, because removing wrappers can occasionally change how a layout looks.
How to stop it coming back
Pages grow slowly. Each new banner, widget or section adds a little, and nobody notices until the warning appears.
- Before adding a new plugin, app or widget, check how the page looks in PageSpeed Insights afterwards.
- Keep lists paginated by default.
- When you rebuild a page, start from a simple layout rather than copying an old one with every wrapper intact.
- Review your busiest pages every few months and remove anything outdated.
- Ask your developer or agency to keep new work lean, and to tell you if a design needs a very large page.
If you want this checked for you, week 4 of SiteMonday is the speed and Core Web Vitals service, and it ends with a written report and a ranked fix list. It finds and explains the problems, and the changes themselves are for you or your developer to make. Related fixes that often go hand in hand are render blocking resources and unused JavaScript.
Step by step for your platform
- Excessive DOM size on WordPress
- Excessive DOM size on Elementor
- Excessive DOM size on Shopify
- Excessive DOM size on Wix
- Excessive DOM size on Webflow
- Excessive DOM size on WooCommerce
- Excessive DOM size on Squarespace
Questions
What number of DOM elements is too many?
Lighthouse has historically warned above about 800 elements and failed pages above about 1,400, with extra checks on depth and children per parent. These limits vary by version, so use them as a guide and focus on getting the number down.
Will a large DOM hurt my Google rankings?
It is not a direct ranking factor on its own. It can slow your pages and affect Core Web Vitals, which Google does take into account, and slow pages are also frustrating for visitors.
Can a caching plugin or CDN fix an excessive DOM size?
Not really. Caching and a CDN deliver the page faster, but the browser still has to build the same large tree of elements. The fix is in the page structure itself.
Why is my page builder making my DOM so big?
Builders often wrap each item in several nested containers, rows and columns so layouts are flexible. Using fewer sections, avoiding deep nesting and removing unused widgets reduces it.
Do hidden elements count towards DOM size?
Yes. Anything in the page's HTML counts, even if it is hidden in a pop-up, tab, accordion or mobile-only menu. Removing unused hidden parts is a quick win.
Do I need a developer to fix this?
Not always. Shortening pages, removing unused widgets and simplifying menus can be done by a site owner. Flattening theme templates or loading sections on scroll usually needs a developer.