PurgeCSS - Remove unused CSS from modern web applications

A widely used tool that removes unused CSS from modern web applications, helping teams ship smaller, faster frontends.

Name
PurgeCSS
Released
Category
Open Source · Developer Tool
The PurgeCSS repository on GitHub

Overview

PurgeCSS is a build-time utility designed to eliminate unused CSS from web projects. Many modern applications rely on large CSS frameworks like Tailwind, Bootstrap, or Materialize, which generate vast numbers of possible selectors — most of which are not used in a given project. PurgeCSS analyzes your project’s source files and your CSS files, matches the selectors used in content with those defined in stylesheets, and removes selectors that aren’t referenced. The result is a leaner final CSS bundle optimized for production.

The tool can be integrated into a range of workflows. It offers a programmatic JavaScript API, a CLI, and plugins for common build tools like PostCSS, Webpack, Gulp, and Rollup. You specify the files to analyze — including HTML, JS, or framework-specific files — and PurgeCSS computes which CSS rules are truly needed. Configuration options allow fine-tuning through extractors and safelists to handle custom selector patterns or avoid removing CSS that is required at runtime.

PurgeCSS is commonly used in production build pipelines to keep CSS payloads small, reducing the amount of CSS that must be downloaded and parsed by browsers. The smaller stylesheet size can meaningfully improve page load times, especially in large applications or those using utility-first frameworks.

Features

  • Command-line interface
  • JavaScript API
  • PostCSS, Webpack, Gulp and Rollup plugins
  • Extractors and safelists
Expected reduction in CSS file size
70%
Weekly downloads on NPM
1.5M+
Projects using PurgeCSS on GitHub
600k+
Contributors
80+

More projects

Personal wedding invitations, thoughtfully digital

EverAfter is a digital wedding invitation platform for Switzerland. Couples create a beautiful invitation, personalize it for every guest, and manage replies in one place, with support for French, German, Italian and English.

Read more

High-performance gene prediction & genome annotation in Rust

Orphos is a modern Rust-based implementation of a prokaryotic gene finding algorithm that identifies protein-coding genes in microbial genomes. It applies an unsupervised machine-learning dynamic programming approach to genome annotation and supports both single genomes and metagenomic data.

Read more

Are you looking to contact us?