GitPedia

Purgecss

Remove unused CSS

From FullHuman·Updated June 17, 2026·View on GitHub·

When you are building a website, chances are that you are using a css framework like Bootstrap, Materializecss, Foundation, etc... But you will only use a small set of the framework and a lot of unused css styles will be included. The project is written primarily in TypeScript, distributed under the MIT License license, first published in 2017. It has gained significant community traction with 8,043 stars and 244 forks on GitHub. Key topics include: css, optimization-tools, postcss, postcss-plugin, purgecss.

Latest release: v8.0.0
January 24, 2026View Changelog →

PurgeCSS

npm
npm
GitHub
Dependabot

<p align="center"> <img src="https://i.imgur.com/UEiUiJ0.png" height="200" width="200" alt="PurgeCSS logo"/> </p>

What is PurgeCSS?

When you are building a website, chances are that you are using a css framework like Bootstrap, Materializecss, Foundation, etc... But you will only use a small set of the framework and a lot of unused css styles will be included.

This is where PurgeCSS comes into play. PurgeCSS analyzes your content and your css files. Then it matches the selectors used in your css files with the ones in your content files. It removes unused selectors from your css, resulting in smaller css files.

You can try PurgeCSS online at purgecss.full-human.com.

Sponsors 🥰

<img src="https://avatars.githubusercontent.com/u/133211198?v=4" height="85" style="margin-right: 10px">

Documentation

You can find the PurgeCSS documentation on this website.

Table of Contents

PurgeCSS

Plugins

Guides

Getting Started

Installation

sh
npm install purgecss --save-dev

Usage

js
import { PurgeCSS } from "purgecss"; const purgeCSSResults = await new PurgeCSS().purge({ content: ["**/*.html"], css: ["**/*.css"], });

Packages

This repository is a monorepo that we manage using Lerna. That means that we actually publish several packages to npm from the same codebase, including:

PackageVersionDescription
purgecssnpmThe core of PurgeCSS
postcss-purgecssnpm (scoped)PostCSS plugin for PurgeCSS
purgecss-webpack-pluginnpmWebpack plugin for PurgeCSS
gulp-purgecssnpmGulp plugin for PurgeCSS
grunt-purgecssnpmGrunt plugin for PurgeCSS
rollup-plugin-purgecssnpmRollup plugin for PurgeCSS
purgecss-from-htmlnpmHtml extractor for PurgeCSS
purgecss-from-pugnpmPug extractor for PurgeCSS
purgecss-with-wordpressnpmCollection of safelist items for WordPress
vue-cli-plugin-purgecssnpmVue CLI Plugin for PurgeCSS

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from FullHuman/purgecss via the GitHub API.Last fetched: 6/21/2026