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 (e.g., Google); I’m an active web and tool developer (code optimization, digital defense), a contributor to web standards (like HTML, CSS, WCAG), and a book author (O’Reilly, Frontend Dogma).
I love trying things—in web development and engineering management, but also in politics and philosophy, where I hold to one idea in particular: that we can only be well if we take good care of everyone. Here on meiert.com I talk about some of my perspectives and experiences. (Please share feedback: Interpret charitably, keep it friendly, but do be critical.)
