Your CSS is 16% dead weight. Time for a funeral.
Find dead CSS in your project. Scans every class, ID, keyframe, and CSS variable — then cross-references your HTML, JSX, TSX, Vue, and Svelte templates to find what's actually used.
CSS-GRAVEYARD v1.0.0
Found: 847 CSS selectors │ 12 CSS files │ 34 template files
── Dead Classes (127 found) ─────────────────────────────────────────
.old-header styles/layout.css:23
.legacy-sidebar styles/layout.css:89
.btn-deprecated styles/buttons.css:145
.hero-v1 styles/pages/home.css:12
.modal-backdrop-old styles/components/modal.css:78
... and 122 more
── Dead Keyframes (3 found) ─────────────────────────────────────────
@keyframes slideInOld styles/animations.css:12
@keyframes fadeOutLegacy styles/animations.css:34
@keyframes pulseV1 styles/animations.css:56
── Dead Variables (8 found) ─────────────────────────────────────────
--color-old-primary styles/variables.css:5
--spacing-legacy styles/variables.css:18
... and 6 more
── Graveyard Stats ──────────────────────────────────────────────────
Dead selectors: 138 of 847 (16.3%)
Dead CSS size: ~12.4 KB of 76.2 KB
Worst file: styles/layout.css (47 dead selectors)
── Top Offenders ────────────────────────────────────────────────────
styles/layout.css 47 dead selectors 6.2 KB wasted
styles/legacy/ 34 dead selectors 3.1 KB wasted
styles/components/modal.css 18 dead selectors 1.8 KB wasted
You inherited a project with 50 CSS files. Which classes are actually used? Nobody knows. Until now.
Over months of development, dead CSS accumulates: legacy component styles, old page variants, renamed classes, removed features. It slows down reviews, confuses new devs, and bloats your bundles.
css-graveyard gives you the map.
npx css-graveyard .
No install needed. Just point it at your project directory.
| File Type | What's Extracted |
|---|---|
.css |
Classes, IDs, keyframes, variables |
.scss |
Classes, IDs, keyframes, variables (nested support) |
.less |
Classes, IDs, keyframes, variables |
.html |
class=, id= attributes |
.jsx / .tsx |
className=, clsx/cn/classnames calls, ternaries |
.vue |
class=, :class= (object + array syntax) |
.svelte |
class=, class:directive |
.js / .ts |
Dynamic class usage, CSS Modules (styles.name) |
If tailwind.config.js (or ts, cjs, mjs) is detected, or tailwindcss is in your package.json dependencies, css-graveyard automatically excludes utility classes from the dead code analysis.
It won't flag flex, p-4, text-lg, hover:bg-blue-500, or any other Tailwind utility as dead — even if they're only in your CSS and not string-matched in templates.
Your custom CSS is still fully analyzed.
// All of these are detected:
import styles from './Button.module.css'
<div className={styles.container}>...</div>
<div className={styles['error-state']}>...</div>
css-graveyard [directory]
Options:
--css <glob> CSS/SCSS directory or glob pattern
--templates <glob> Template directory or glob pattern
--ignore <pattern> Glob pattern to ignore (repeatable)
--json Output results as JSON
--format <type> Output format: terminal (default), json, md
--strict Exit with code 1 if dead CSS > threshold
--threshold <number> Dead CSS % threshold for --strict (default: 10)
--no-color Disable colored output
-V, --version Show version
-h, --help Show help
# Scan a specific directory
css-graveyard src/
# Specify CSS and template directories separately
css-graveyard --css styles/ --templates src/
# Ignore vendor and legacy directories
css-graveyard . --ignore "vendor/**" --ignore "legacy/**"
# JSON output for programmatic use
css-graveyard . --json | jq '.stats'
# Full Markdown report
css-graveyard . --format md > DEAD-CSS.md
# CI: fail if dead CSS > 5%
css-graveyard . --strict --threshold 5
Add to your CI pipeline to catch CSS bloat before it ships:
# GitHub Actions
- name: Check for dead CSS
run: npx css-graveyard . --strict --threshold 10
If dead CSS exceeds the threshold, the command exits with code 1, failing the CI step.
PurgeCSS REMOVES CSS from your bundle. css-graveyard FINDS dead CSS in your source.
They solve different problems:
| Tool | Purpose |
|---|---|
| css-graveyard | Identify dead CSS in source files — for cleanup and review |
| PurgeCSS | Strip unused CSS from production builds — for bundle size |
Use both: css-graveyard to find and understand what's dead, PurgeCSS to strip it from builds.
MIT © 2026 Nicholas Ashkar