CSS Class Inspector Bookmarklet
Hover any element to see its tag, ID and CSS classes, then click to copy a unique CSS selector. A free bookmarklet for faster front-end debugging.
On a phone? Use Copy code, then save it as a bookmark's URL — step-by-step guide.
CSS Class Inspector turns your cursor into a lightweight element inspector. Hover anything on the page and a tooltip shows its tag, ID, classes and size, while an outline marks exactly which box you are on. The panel in the corner lists every class of the hovered element as a chip you can click to copy.
Click the element itself and the bookmarklet builds a short, unique CSS selector for it, using a unique ID when one exists, otherwise classes and :nth-of-type() only where needed, and copies it to your clipboard. That is perfect for writing test selectors in Playwright or Cypress, user styles, ad-block rules, analytics click triggers or bug reports.
It is faster than DevTools for quick questions like "which utility classes does this card use?" and it works on any page, including ones where right-click is disabled. Press Esc to exit.
What it does
- Hover outline and tooltip with
tag#id.classand the element size - Panel shows the hovered element's classes as click-to-copy chips
- Click an element to copy a short, unique CSS selector (verified with
querySelectorAll) - Keeps a list of the last selectors you copied
- Blocks the page's own click action while active so links do not navigate; Esc exits
How to install the CSS Class Inspector bookmarklet
- Show your bookmarks bar. Press
Ctrl+Shift+Bon Windows/Linux orCmd+Shift+Bon a Mac (Chrome, Edge, Brave, Firefox). In Safari choose View › Show Favorites Bar. - Drag the blue button above onto the bar. That's it — the bookmark now holds the code.
- 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
- Click CSS Class Inspector in your bookmarks bar.
- Move the mouse over the page; the tooltip and panel update as you go.
- Click an element to copy its unique selector, or click a class chip in the panel to copy just that class.
- Press Esc (or run the bookmarklet again) to stop inspecting.
Getting stable selectors
The generated selector is unique on the current page, but how stable it is depends on the site. Selectors based on an ID or meaningful class names survive redesigns; selectors with :nth-of-type() break when content is added. Sites built with CSS-in-JS often have hashed class names like css-1x2y3z that change on every deploy, so prefer IDs, ARIA attributes or data attributes for long-lived test selectors. Elements inside iframes and closed shadow roots cannot be inspected from the top page.
Bookmarklet code
This is the exact code inside the button above (8,660 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 change the page?
No. It only adds a temporary overlay and blocks clicks while it is active. Close it and the page behaves normally.
Is the copied selector always unique?
The bookmarklet checks it with querySelectorAll before copying, so it matches exactly one element on the page at that moment.
Can I inspect elements inside iframes?
Only if you open the iframe's page directly. Scripts on the top page cannot reach into other documents.
Related bookmarklets
Hover text to see its font stack, the font actually rendered, size, weight, line height and color, plus a summary of all…
Hover and click to hide ads, popups, banners or any element on a page, with Undo and Restore all. Ideal for clean…
Outline every element on a page with a color based on its nesting depth to spot overflow, stray margins and layout bugs…
Count DOM elements, nodes and nesting depth on any page, with a sortable per-tag table and Lighthouse DOM-size…