About PurgeCSS
Key Benefits
- Reduces CSS file size by removing selectors that do not match any content in your HTML, templates, or JavaScript.
- Integrates directly into popular build pipelines through plugins for PostCSS, Webpack, Gulp, and Grunt.
- Supports major front-end frameworks including Vue.js, Nuxt.js, React.js, Next.js, Razzle, WordPress, and Hugo.
- Provides a safelisting mechanism to preserve specific selectors you want to keep regardless of content analysis.
- Allows custom extractors to handle CSS usage detection in non-standard file types or template syntaxes.
How It Works
You point PurgeCSS at your content files (HTML, JS, templates) and your CSS files. It builds a list of selectors used in the content, then compares that list against all selectors in your CSS. Any selector not found in the content gets stripped from the final output. You can configure the tool via a configuration file, command-line interface, or programmatic API.
Use Cases
- Front-end developers using PostCSS who want to automate unused CSS removal as part of their build step.
- Webpack users who need a leaner production bundle without dead CSS selectors bloating the output.
- Gatsby and Next.js site owners looking to reduce the CSS payload shipped to visitors.
- Vue.js and React.js developers who write component-scoped styles and want to eliminate global CSS leftovers.
- WordPress theme developers who inherit large CSS frameworks and need to strip unused utility classes.
- Hugo static site builders who want minimal CSS output for faster page loads.
Why Choose This Product
PurgeCSS is best suited for developers already using a build tool such as Webpack, Gulp, or PostCSS who want a configurable, automated way to remove dead CSS. It supports safelisting and custom extractors for edge cases, though you must verify that dynamically generated class names in your JavaScript are caught by your extractors or safelisted explicitly.
PurgeCSSPros & Cons
- Free and open source (MIT licensed)
- Integrates with PostCSS, Webpack, Gulp, and Grunt
- Supports safelisting to preserve specific selectors
- Custom extractors for non-standard file types
- Framework-specific guides for Vue, React, Next.js, and more
Key Features
Unused CSS removal
Removes CSS selectors that do not match any selector found in your project's content files.
Custom extractors
Supports custom extractors to detect CSS class usage in non-standard file types or template syntaxes.
Safelisting selectors
Lets you specify selectors that should never be removed regardless of content analysis.
Programmatic API
Process CSS through a JavaScript API for integration into custom build scripts.
CLI usage
Runs from the command line without requiring a configuration file or build setup.
Framework support
Works with Vue.js, Nuxt.js, React.js, Next.js, Razzle, WordPress, and Hugo through dedicated guides.
PurgeCSS Pricing
Pricing extracted from the product website and may change. Check the source for current details.
How PurgeCSS compares
PurgeCSSThis | ||||
|---|---|---|---|---|
| Starting price | Free | Free | — | 69.00 |
| Pricing model | Free | Freemium | Freemium | Freemium |
| Platforms | Web | macOS, Web | Web | macOS, Windows |
| Top features |
|
|
|
|
| Rating | — | — | — | — |

