If you’ve ever used any major page speed tool to measure the speed and performance of your WordPress site, chances are you’ve come across the excessive DOM size warning before.
There are a lot of issues that an excessive DOM size presents and learning what causes this issue as well as what the DOM is is critical to secure a sustainable WordPress site performance score.
This article will cover everything you need to know about the DOM, what causes excessive DOM size, how to check the DOM size of your WordPress site, and steps you can take to avoid excessive DOM size in WordPress altogether.
Let’s get to it.
What is the DOM?
DOM stands for Document Object Model and is a tree-like structure constructed by browsers whenever a page is requested for and rendered.
You can think of the DOM as the code-equivalent skeleton of pages. It comprises all the HTML tags responsible for the layouts and content displayed on a webpage.
Each HTML tag present in the DOM can also be referred to as an Element or Node. Each node can have a parent/child with another.

In the example above, the div element is the parent of other elements because they are wrapped inside its closing and opening tags.

As you can see from the screenshot above, the DOM a browser generates for each page it loads can be quite complex, spanning hundreds of lines of code.
If you’d like a more in-depth explanation of how the DOM works, I recommend this article by Ilya Grigorik.
What does Excessive DOM size mean?
An Excessive DOM size is when there’s a high number of nodes or HTML tags being generated for a page when rendered by a browser.
Excessive DOM sizes are most common with pages that have huge amounts of content and sometimes poorly coded HTML and JavaScript implementations.
News websites like BBC.com, for example, will naturally have pages with excessive DOM sizes due to the large amount of content being rendered by the browser on load.
Generally speaking, having an excessive DOM size shouldn’t cause alarm, especially when you have page optimisation techniques like deferring and lazy loading in place.
With that said, there is some overall drawback to having an excessive DOM size.
How does Excessive DOM Size Affect Page Speed and Performance?
When a user’s browser requests a page, a DOM tree is generated from which what the user sees is rendered.
This DOM tree generation and rendering include all the HTML, CSS, and JavaScript required to display a page.
When an excessively large DOM tree with nodes of more than 800 is generated, there’s an overall drop in performance and page loading speed.
Depending on the severity of the size of a page’s DOM tree, a browser might struggle, lag and even fail to load a page.
This is especially true for mobile devices that have limited RAM.
An Excessive DOM size also increases the data cost for page visitors, as pages with more content will naturally require more bandwidth.
In a nutshell, a page with an excessive DOM size can affect memory performance, page loading speed, and runtime experience.
How to Check the DOM size of a WordPress site
The easiest way to check the DOM size for WordPress sites is by using a page performance tool like SeoSiteCheckup.
Simply visit their website and navigate to the DOM size test page, which is free to use.
After entering the URL of your WordPress site, click the Checkup button and the wizard should start its analysis.
Once it’s completed, you’ll see the total number of nodes for the URL provided.
You can also use the Dom Size Analyzer chrome extension if you use the chrome browser and you’re comfortable using the developer tools feature.

In most cases, though, you’ll find yourself using Google’s Pagespeed Insights tool or GTmetrix which only apparently displays a DOM size count and warning when excessive.
What causes the “avoid an excessive DOM size” warning
The “avoid an excessive DOM size” is triggered when a page has more than 800+ Nodes generated in its body element when loaded.
Lighthouse, which is an open-source page performance tool by Google flags pages with more than 800+ nodes units body element as “Excessive DOM size”.
This is the same standard other page performance tools like GTmetrix also use when checking page DOM size.
Another important fact to note is, when the node count in the body element of any page exceeds 1,400, an error is triggered instead of a warning.
Overall, it’s best to keep the DOM size of all the pages on your website low.
How To Avoid Excessive DOM size in WordPress
So far, we’ve talked about what triggers the excessive DOM size warning, but we haven’t gone over how you can avoid the warning altogether.
To avoid excessive DOM size in WordPress, make sure the total number of nodes on each page does not exceed 800. This can be achieved by avoiding outdated themes and plugins with bloated code.
Most poorly coded themes or plugins add a lot of scripts to power the layouts on each page, which increase the default node count irrespective of content.
You should also avoid outdated page builders like WPBakery as they also come with their own set of bloated scripts and stylesheets.
Sticking to well-known WordPress building frameworks like Genesis, GeneratePress, and page builders like Oxygen and Elementor will keep you on the safe side of things when it comes to avoiding excessive DOM size.
Whatever you decide to build technology you decide to go with, just make sure it has lean code with many options to optimise even further.
You should also avoid adding too much content on any page except it’s absolutely necessary and even then, try keeping things as simple as possible by using fewer HTML tags and scripts.
How to Reduce DOM Size Technically?
The DOM is generated by a browser when it renders all the stylesheet, script, and HTML files tied to a page URL.
The total number of elements present on the DOM can, in most cases, be reduced by restructuring the HTML file.
As an example, examine the HTML code snippet below:
As you can see, there are three <div> elements present in our code. We can restructure this to reduce DOM size by using just a single <div> item:
We can take it one step further by using just a single <p> tag and two <br> tags:
The more elements you can get rid of without affecting the structure or look of a page, the better the DOM size.
How to Fix the “avoid excessive DOM size” Warning for WordPress
If you already have a WordPress site with the “excessive DOM size” warning, here are some fixes you can try.
Split pages with large content into multiple pages
Instead of having a huge 20-section services page with a ton of content, to avoid the excessive DOM size warning, it’s best to split the content into multiple pages.
So, instead of listing each and every service you offer on a single page, you simply list them with a small description and link to a dedicated page with all the information for that specific service.
You can apply this to other pages like About us and even the homepage. The key here is splitting your WordPress site’s content into dedicated pages and tying it all together with links and a good navigation system.
Remove unwanted Elements without hiding them with CSS
The normal assumption of most inexperienced WordPress users is that hiding elements on a page with CSS gets rid of them completely.
This is simply not true, using CSS properties like display: none or visibility: hidden on an element simply prevents it from being displayed by the browser. It doesn’t stop the browser from rendering it as part of the DOM.
This is one of the common mistakes a lot of WordPress users make. By hiding sections with a lot of content repeatedly using CSS, the node count increases, thereby slowing down page load time and overall performance.
Whenever an element or section in your website is no longer needed, you have to remove the underlying HTML responsible for it.
Most WordPress sites these days use page builders, so it shouldn’t be difficult to quickly edit and remove the parts you don’t want.
For WordPress themes that purely rely on code, you might need a developer to do the removal for you.
Sanitise text before pasting it into the post/page editor
A lot of people don’t realise it but sometimes when text is copied from a page or other text editors, it comes with some markup attributes.

These unnecessary markups, if not cleaned up, can increase the node count of a WordPress post/page.
Luckily, there are different ways to make sure all markup attributes are cleared when pasting. The easiest would be using Ctrl/Cmd + Shift + V instead of Ctrl/Cmd + V while pasting, this get’s rid of all formatting and just pastes the text.
You can also use an online tool like TextCleanr if you want to keep the formatting but get rid of unnecessary markup attributes.
Overall, always make sure whatever you’re pasting in the Classic or Gutenberg Editor is free from bloated HTML inline styling.
Limit post listing and other dynamic content by adding pagination
If your WordPress website has a blog, then chances are you have your blog posts listed on the homepage.
Now, this is completely fine and does have some SEO benefits when done right, the problem a lot of WordPress site owners make is displaying too many posts on the homepage.
When the number of post listings being dynamically added to the page is excessive, it can affect performance and increase the DOM size.
It’s best practice to limit the number of posts loaded and add a pagination system or load more buttons in case the users want to see more.
This doesn’t apply to just blog posts. Any WordPress post type should also be listed with limits in place as too many listings can drastically increase the element count and lead to different performance problems
In a Nutshell
The most important thing to remember when trying to avoid an excessive DOM size in WordPress is to keep your code clean and well-organised.
By using the techniques outlined in this article, you can keep your DOM size under control and improve the performance of your WordPress site.
Thanks for reading and hope. I you’ve found this article helpful!
FAQs
How to Avoid an Excessive DOM Size in WordPress? ›
'Avoid excessive-DOM size' in short
An excessive DOM size means that there are too many DOM Nodes (HTML tags) on your page or that these html tags are 'nested' too deep. While loading the page with an excessive amount of DOM nodes, a browser will often need more computing power to 'render' the page.
- Avoid poorly coded plugins and themes. ...
- Minimize JavaScript-based DOM nodes. ...
- Page builders that generate bloated HTML. ...
- Don't copy/paste text into the WYSIWYG editor. ...
- Break down your one-page website into multiple pages. ...
- Don't hide unwanted elements using display:none.
'Avoid excessive-DOM size' in short
An excessive DOM size means that there are too many DOM Nodes (HTML tags) on your page or that these html tags are 'nested' too deep. While loading the page with an excessive amount of DOM nodes, a browser will often need more computing power to 'render' the page.
Your web browser parses HTML documents and builds a Document Object Model (DOM) that it can easily understand and manage. In this format, it can be easily understood — and modified — by a scripting language such as JavaScript. Google recommends the DOM: Have fewer than 1,500 nodes in total.
How do I reduce DOM processing time? ›Reduce the DOM to optimize CSS
If a developer splits up a CSS file, it can also reduce the DOM size. Whether the CSS file is split, shrunk or divided into multiple, smaller files, each option reduces the number of DOM elements in the HTML and helps improve webpage load time.
- The Before() Method. True to its name, the before() method is used when you want to insert any element before another target element, as indicated in the code. ...
- The After() Method. ...
- The Append() Method. ...
- The Prepend() Method. ...
- The Clone() Method. ...
- The Wrap() Method.
- Defer JS.
- Remove Unused JS and Delay JS.
- Minify JS.
- Minify CSS.
- Defer Non-Critical CSS.
- Don't use poorly coded plugins or themes. ...
- Minimize DOM nodes created by JavaScript. ...
- Don't use page builders that generate bloated HTML. ...
- Don't copy-paste text into the WYSIWYG editor. ...
- Don't hide unwanted elements using CSS. ...
- Tip #1: Implement lazy load and infinite scroll.
- By iterating the DOM nodes and using the removeChild method.
- By Erasing the innerHTML value to a blank string.
- By using jQuery's empty() method.
- Using the replaceChildren() method.
All the objects that constitute the HTML structure of the page, i.e. all the tags included in it (HTML, BODY, DIV, H1, H2, etc), are called nodes and the sum of them is translated as the DOM size.
How many DOM objects are too many? ›
While browsers can handle larger DOM trees, they are optimized for a maximum of 32 elements deep. A large DOM tree can harm your page performance in multiple ways: Network efficiency and load performance.
What is the maximum number of DOM elements? ›There is no limit for the DOM.
What is a large DOM? ›A large DOM tree often includes many nodes that aren't visible when the user first loads the page, which unnecessarily increases data costs for your users and slows down load time. Runtime performance. As users and scripts interact with your page, the browser must constantly recompute the position and styling of nodes.
How do I speed up DOM manipulation? ›- Avoid DOM manipulations inside loops. ...
- Don't use DOM values inside loops. ...
- Use css classes instead inline styles. ...
- Use innerHTML only for first rendering and then use DOM methods.
How is Virtual DOM Faster? The answer to this question can also be found on how the virtual DOM works. Since there is no direct access or change to the DOM elements in Virtual DOM, that alone makes it extremely fast.
What are ways to reduce the load time of a web application? ›- Choose a performance-optimized hosting solution. ...
- Compress and optimize your images. ...
- Reduce your redirects. ...
- Cache your web pages. ...
- Enable browser caching. ...
- Use asynchronous and defer loading for your CSS and JavaScript files. ...
- Minify CSS, JavaScript, and HTML.
...
jQuery DOM Manipulation.
Method | Description |
---|---|
prepend() | Insert content at the beginning of an element(s) specified by a selector. |
remove() | Removes element(s) from DOM which is specified by selector. |
replaceAll() | Replace target element(s) with specified element. |
To give access to Pages based on WordPress roles, navigate to the Page Access tab, and under Page Restrictions, enter the role(s) of a user who will be allowed to access the pages. You can also restrict pages for custom roles. (By default all pages and posts are accessible to all users irrespective of their roles).
What object manipulates DOM elements? ›To perform any form of DOM manipulation, you have to access the document object first. Next we have the html root element which is a child of the document object. Next on the line are the body and head elements which are siblings to each other and children of the html element.
How do I fix avoid long main-thread tasks in WordPress? ›- Find your longest tasks.
- Avoid bloated themes, page builders, plugins.
- Activate built-in page builder optimizations.
- Don't use page builders for your header, footer, sidebar.
- Unload CSS/JavaScript.
- Remove jQuery-dependent plugins.
How do I reduce main-thread work? ›
- reducing the time spent evaluating scripts.
- minimizing style and layout recalculations.
- reducing the time spent parsing CSS/HTML/JavaScript.
- preventing the delay in rendering page pixels.
- Step 1: Install WP Super Minify. ...
- Step 2: Locate the WP Super Minify Settings. ...
- Step 3: Minify Your CSS and JavaScript Files.
- Take a local copy of the dom-example. ...
- Add a <script></script> element just above the closing </body> tag.
- To manipulate an element inside the DOM, you first need to select it and store a reference to it inside a variable.
DOM traversal (also called walking or navigating the DOM) is the act of selecting nodes in the DOM tree from other nodes. You're probably already familiar with several methods for accessing elements in the DOM tree by their id, class, or tag name. You can use methods like document. querySelector() and document.
What is a DOM solution? ›What is Distributed Order Management? DOM can be defined as a software system that provides integrated fulfillment planning and execution across multi-echelon, multi-node, multi-partner, and multi-channel supply chain networks.
Can we manipulate DOM? ›DOM manipulation in javascript is the process of interacting with the DOM API to change or modify an HTML document that will be displayed in a web browser. By manipulating the DOM, we can create web applications that update the data in a web page without refreshing the page. The DOM stands for Document Object Model.
How to disable button using DOM? ›The HTML DOM Button disabled property is associated with disabled attribute of the <button> element . The button disabled property is used to set or return whether a given button is disabled or not. It is used to disable the button so that the user can no longer interact with the specified element.
How do I check my DOM? ›- Focus your cursor on the Elements panel.
- Press Control + F or Command + F (Mac). The Search bar opens at the bottom of the DOM Tree.
- Type The Moon is a Harsh Mistress . The last sentence is highlighted in the DOM Tree.
The media files on your server probably account for the majority of your website's bulk. This is to be expected, but WordPress is particularly notorious for creating various duplicates of the same file and making your media folder two or three times larger than it needs to be.
How do I optimize DOM output in Elementor? ›Simply go to Elementor > Settings > Advanced and select Enable in the Optimized DOM Output dropdown. Note: If unable to edit your text in the main window, and only able to edit text in the editor panel, try disabling the Optimized DOM Output experiment.
Is DOM Manipulation good or bad? ›
The Document Object Model (DOM) is a web browser's hierarchical representation of the elements on the page. Websites can use JavaScript to manipulate the nodes and objects of the DOM, as well as their properties. DOM manipulation in itself is not a problem.
What are the disadvantages of using DOM? ›Disadvantages of DOM
These are: It consumes more memory when the XML structure becomes large. Its operational speed is slower due to the larger usage of memory. Stores the entire document in memory.
- createElement() — create a new element.
- setAttribute() — set any needed attributes, such as ID's or classes.
- createTextNode() — create any needed content.
- appendChild() — attach the new text node to the element.
- Methods. There are five methods for accessing elements in a document. ...
- Method One: getElementById() ...
- Method Two: getElementByClassName() ...
- Method Three: getElementsByTagName. ...
- Method Four: querySelector() ...
- Method Five: querySelectorAll() ...
- Conclusion.
An HTML element is a component of an HTML document that tells web browser how to structure and interpret a part of the HTML document. The Document Object Model (DOM) is a programming interface for web documents.
How do I remove the DOM size in WordPress? ›- Dividing large pages into multiple pages.
- CSS should not be used to conceal undesired elements.
- Don't use plugins that aren't well-coded.
- Remove any unneeded elements from the default WordPress theme.
- Use the most latest versions of your page builder.
What is the DOM? The Document Object Model (DOM) is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects; that way, programming languages can interact with the page.
What is the count of DOM nodes? ›The DOM node count graph shows the number of created DOM nodes that are still held in memory, i.e. which have not been garbage collected yet. This doesn't have to coincide with the elements you get through getElementsByTagName . The latter will also only get you the elements actually attached to the document tree.
How can avoid an excessive DOM size? ›- Avoid poorly coded plugins and themes. ...
- Minimize JavaScript-based DOM nodes. ...
- Page builders that generate bloated HTML. ...
- Don't copy/paste text into the WYSIWYG editor. ...
- Break down your one-page website into multiple pages. ...
- Don't hide unwanted elements using display:none.
Optimizing the DOMContentLoaded event means reducing the amount and size of resources that block the parsing and rendering of the HTML document. To do this, minify and compress HTML, CSS, and JavaScript files to reduce bytes and requests.
What is the difference between DOM and DOM manipulation? ›
In website development, DOM stands for Document Object Model. It is a programming interface that allows us to create, change, or remove elements from a website document. DOM manipulation is when you use JavaScript to add, remove, and modify elements of a website.
Why is DOM Manipulation expensive? ›DOM Manipulation is Costly
As the DOM is represented with a tree structure, querying and updating are usually faster than rendering. However, it may also be costly if we have to traverse a good portion of the DOM tree to find the node to update.
A virtual DOM object has the same properties as a real DOM object, but it lacks the real thing's power to directly change what's on the screen. Manipulating the DOM is slow. Manipulating the virtual DOM is much faster because nothing gets drawn onscreen.
Why virtual DOM is better than DOM? ›A virtual DOM object is the same as a real DOM object, except that it is a lightweight copy. This means that it cannot manipulate on-screen elements. Moreover, upon any change of a property, it only updates the corresponding nodes and not the entire tree. That makes it a quick and efficient alternative.
How can I improve my website speed and performance? ›- Reduce the Number of HTTP Requests. ...
- Switch to HTTP/2. ...
- Optimize Image Sizes. ...
- Use a Content Delivery Network (CDN) ...
- Write Mobile-First Code. ...
- Minimize Time to First Byte. ...
- Choose the Right Hosting Service Plan. ...
- Implement Gzip Compression.
- Make sure you are using a proper hosting service. ...
- Invest in a good bot management solution. ...
- Reduce bloat and resource sizes. ...
- Optimize your database. ...
- Pre-fetching. ...
- Avoid web fonts. ...
- Eliminate 404 errors. ...
- Keep everything updated.
All the objects that constitute the HTML structure of the page, i.e. all the tags included in it (HTML, BODY, DIV, H1, H2, etc), are called nodes and the sum of them is translated as the DOM size.
How to avoid enormous network payloads in WordPress website? ›- Use Lazy Loading. ...
- Image Compression. ...
- Allow NextGen Image Optimization with WebP Support. ...
- Use CDN. ...
- Better Use JPG Image Format over PNG. ...
- Remove Unnecessary JavaScript and CSS files. ...
- Avoid reCAPTCHA. ...
- Deactivate Themes and Plugins Features.
To remove an element from the DOM, you can also use the remove() method of the element. How it works. First, select the last element of the ul element. Second, call the remove() of that element to remove it from the DOM.
How many DOM elements are too many? ›While browsers can handle larger DOM trees, they are optimized for a maximum of 32 elements deep. A large DOM tree can harm your page performance in multiple ways: Network efficiency and load performance.
How do I find the DOM of a website? ›
You can search the DOM Tree by string, CSS selector, or XPath selector. Focus your cursor on the Elements panel. Press Control + F or Command + F (Mac). The Search bar opens at the bottom of the DOM Tree.
How do I exceed the maximum upload size in WordPress? ›Open the file in any text editor and add the following code. @ini_set( 'upload_max_size' , '20M' ); @ini_set( 'post_max_size', '13M'); @ini_set( 'memory_limit', '15M' ); Save your changes, and it should increase your file upload size.
How do I reduce the size of a database in WordPress? ›- Perform Database Optimization for MyISAM tables.
- Delete all automatically created post and page drafts.
- Delete all page and post revisions.
- Delete all posts and pages in your Trash.
- Delete all comments marked as Spam.
- Delete all expired Transients.
- Defer requests until they're needed. See the PRPL Pattern for one possible approach.
- Optimize requests to be as small as possible. Possible techniques include: ...
- Cache requests so that the page doesn't re-download the resources on repeat visits.
- Run a Site Speed Diagnosis. ...
- Delete Unused Plugins and Themes. ...
- Clean Up Your Media Library. ...
- Clean Up Your Database. ...
- Remove Render-Blocking Javascript and CSS. ...
- Minify CSS, HTML, and JavaScript. ...
- Optimize Images. ...
- Lazy-Load Long Pages.
High Traffic WordPress
WordPress is capable of handling heavy traffic. However, the performance of your website highly depends on your hosting service and your optimization techniques. It is recommended to have a scalable, managed WordPress hosting plan to avoid disruptions.
...
Remove an Element Node
- Suppose books. ...
- Set the variable y to be the element node to remove.
- Remove the element node by using the removeChild() method from the parent node.
The Element.remove() method removes the element from the DOM.