# Are There Any Stats About DOM Sizes in Modern Pages?

**URL:** <https://discuss.httparchive.org/t/are-there-any-stats-about-dom-sizes-in-modern-pages/1619>\
**Category:** Analysis\
**Created:** [March 29, 2019, 5:18am UTC](https://discuss.httparchive.org/t/are-there-any-stats-about-dom-sizes-in-modern-pages/1619 "2019-03-29T05:18:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rviscomi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/rviscomi/32/835_2.png) [@rviscomi](https://discuss.httparchive.org/u/rviscomi)\
**Post date:** [March 29, 2019, 5:18am UTC](https://discuss.httparchive.org/t/are-there-any-stats-about-dom-sizes-in-modern-pages/1619/1 "2019-03-29T05:18:15Z")

</div>

[Question on r/webdev on reddit](https://www.reddit.com/r/webdev/comments/b6qxvf/question_are_there_any_stats_about_dom_sizes_in/):

> I would like to have some grasp on how many dom elements (nodes) are _normally_ found in modern web pages. Of course, I don’t mean exact, just in what size orders are we talking nowadays. I don’t even know what is _normal_ page anyways, and dynamic nature of web today (we can add/remove nodes with JS at runtime) makes it impossible to count such stats precisely. Anyway, I would like to give it a shot and ask if there are some stats about what is normally found these days. Like are we talking about size order of hundreds of elements in today’s DOM trees, or thousands, or tens of thousands? I have read some blog post where sizes around 5K ~ 20K seems to appear (somebody mentioned in comments), but that was nothing really confirmed nor were there any references to follow.
> 
> Yeah, I am aware it’s a long shot, but anyway, if there are any good stats I would really like to see them. I wasn’t able to find something myself.

The `summary_pages` dataset includes a `numDomElements` field that answers this question directly. Here’s a query that analyzes the 10, 50, and 90th percentiles over time for both desktop and mobile:

```sql
SELECT
  REPLACE(SUBSTR(_TABLE_SUFFIX, 0, 10), '_', '-') AS date,
  IF(ENDS_WITH(_TABLE_SUFFIX, 'desktop'), 'desktop', 'mobile') AS client,
  APPROX_QUANTILES(numDomElements, 1000)[OFFSET(100)] AS p10_dom_size,
  APPROX_QUANTILES(numDomElements, 1000)[OFFSET(500)] AS median_dom_size,
  APPROX_QUANTILES(numDomElements, 1000)[OFFSET(900)] AS p90_dom_size
FROM
  `httparchive.summary_pages.*`
GROUP BY
  date,
  client
ORDER BY
  date,
  client

```

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/httparchive/original/2X/4/4f713daaac5383f34d3322ddef7457aaef8f5ae7.png)

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/httparchive/original/2X/a/ae787e6f4bc9248b820f2332de254cd74b6869a6.png)

[Here’s a sheet with the raw results](https://docs.google.com/spreadsheets/d/13JSvPTOmf4tbwhJdhSaDAmxcY4A9bbeQ9tSdtIk7XL4/edit?usp=sharing)

A little surprised that mobile DOM size wasn’t available until 2016 but here we are. The distribution hasn’t actually changed too much over the years.

If you just want a simple query to get the latest median DOM size:

```sql
SELECT
  APPROX_QUANTILES(numDomElements, 1000)[OFFSET(500)] AS median_dom_size
FROM
  `httparchive.latest.summary_pages_desktop`

```

It’s about 600 elements.

---

<div class="post-metadata">

**Author:** ![patmeenan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/patmeenan/32/605_2.png) [@patmeenan](https://discuss.httparchive.org/u/patmeenan)\
**Post date:** [March 29, 2019, 12:18pm UTC](https://discuss.httparchive.org/t/are-there-any-stats-about-dom-sizes-in-modern-pages/1619/2 "2019-03-29T12:18:08Z")

</div>

Prior to 2016, mobile testing was done on physical iOS devices running an agent with limited capabilities compared to the main desktop agent. In 2016 we switched it over to emulation so it could scale up which also opened up the full capabilities.
