bookmarklet.one

Element Counter Bookmarklet

Count DOM elements, nodes and nesting depth on any page, with a sortable per-tag table and Lighthouse DOM-size thresholds. Free bookmarklet, no extension.

Element Counter
← Drag this button to your bookmarks bar.Click it here to try it on this page first.

On a phone? Use Copy code, then save it as a bookmark's URL — step-by-step guide.

Web Dev Performance DebuggingUpdated 2026-11-27Free · No extension · Runs locally

Element Counter measures how big and how deep a page's DOM is. It counts all elements, text nodes and comments, finds the deepest nesting level and the element with the most direct children, and breaks everything down into a sortable table of tags with counts and percentages.

DOM size has a real effect on performance: every extra node costs memory, slows down style recalculation and layout, and makes JavaScript that queries the page slower. Lighthouse flags an "excessive DOM size" when a page passes roughly 1,400 elements, nests deeper than 32 levels or has a parent with more than 60 children. This bookmarklet shows those three numbers right away, colored green, amber or red, so you know if the page needs work.

The tag table quickly reveals the usual culprits: thousands of div wrappers, inline svg icons repeated on every card, or huge hidden menus. Export it as CSV for your audit notes.

What it does

  • Total elements, total nodes, text nodes and comments
  • Maximum nesting depth with the selector of the deepest element
  • Largest number of direct children on one parent
  • Status colors based on Lighthouse DOM-size thresholds
  • Sortable per-tag table with counts and percentages, plus Copy as CSV

How to install the Element Counter bookmarklet

  1. Show your bookmarks bar. Press Ctrl+Shift+B on Windows/Linux or Cmd+Shift+B on a Mac (Chrome, Edge, Brave, Firefox). In Safari choose View › Show Favorites Bar.
  2. Drag the blue button above onto the bar. That's it — the bookmark now holds the code.
  3. Open any website and click the bookmark to run it on that page. Click it again to close it.

Can't drag (phone, tablet, locked-down browser)? Copy the code below, create any bookmark, then edit it and paste the code as its URL. See how to add a bookmarklet in every browser.

How to use it

  1. Open the page you want to audit and let it load fully (scroll if content loads lazily).
  2. Click Element Counter in your bookmarks bar.
  3. Check the summary numbers at the top; red values need attention.
  4. Sort the tag table by count or name, and copy it as CSV if you need it in a report.

What counts as too big

Lighthouse starts warning at about 800 elements and fails the audit above about 1,400, but the threshold is a guide, not a rule: a 2,000-element page with simple CSS can be fast, while a 900-element page with complex selectors can be slow. Depth matters for CSS performance and for layout; very deep trees usually come from component wrappers. To shrink the DOM, render long lists lazily, replace repeated inline SVGs with a sprite, and remove hidden duplicate navigation. The count includes elements that are hidden with CSS, because they still cost memory.

Bookmarklet code

This is the exact code inside the button above (8,085 characters). It runs only in your browser and sends nothing to us. Paste it into the Bookmarklet Decoder to read it formatted.

Frequently asked questions

Does it count elements inside iframes?

No. Iframes are separate documents. Each iframe is counted as one element; open its URL to measure it separately.

What about shadow DOM?

Elements inside shadow roots are not part of the main document tree. The tool reports how many open shadow roots it found so you know they exist.

Why is my number different from Lighthouse?

Lighthouse counts elements inside the body at load time, while this tool counts the whole document at the moment you click, including content added later.

Related bookmarklets

Find unused CSS rules on any page: see the unused percentage per stylesheet and a list of selectors that match nothing.…

Outline every element on a page with a color based on its nesting depth to spot overflow, stray margins and layout bugs…

List every stylesheet on a page, linked, inline and adopted, with rule counts and sizes. Copy, view or download the CSS.…

List inline and property event handlers (onclick, oncontextmenu and more) on any page, jump to each element, and get a…