CSS: Deduplicate and Speed Up Your Style Sheets With CSS Dedup
Published on Jul 16, 2026, filed under tools, development, css, maintainability, performance, optimization. (Share this post, e.g., on Mastodon.)
Using declarations just once (UDJO) is an old but underused CSS optimization technique that can help CSS maintainability and performance. It was, as far as I know, first explained in 2008.
As UDJO is a technique whose effectiveness depends on style sheet complexity and selector lengths, and as it cannot be trivially automated, for the longest time, UDJO has been just that—a technique, used by few CSS optimizers.
There’s now a tool available that attempts to automate, at least inform this work: CSS Dedup (source).
CSS Dedup enables you to check style sheets on declaration repetition and to deduplicate them:
Try CSS Dedup out yourself, running it in report mode:
npx css-dedup .Once you feel comfortable with it, you can explore additional options. One option that may be particularly interesting is to “fix” duplication where safe and only when there are file size savings:
npx css-dedup --fix --savings-only .You have more options, then, like taking a less conservative approach using --aggressive, and you can use CSS Dedup programmatically as well as as a PostCSS plugin, too.
The tool is still fresh: If you run into an issue, please report it. And if this work helps you or your organization, please consider paying for the value you get from it. Thank you—and enjoy!
About Me
I’m Jens (long: Jens Oliver Meiert), and I’m an engineering lead, guerrilla philosopher, and indie publisher. I’ve worked as a technical lead and engineering manager at various companies, including Google; I’m an open-source developer and a contributor to web standards (like HTML, CSS, WCAG); and I write and review books for O’Reilly and Frontend Dogma.
I love trying things, not only in web development and engineering management, but also with respect to politics and philosophy. Here on meiert.com I talk about some of my experiences and perspectives. (Please share feedback—interpret charitably, keep it friendly, but do be critical.)
