Critical CSS Extractor
Extract above-the-fold CSS from pasted HTML and stylesheets, fully in-browser.
Input
0 charsCritical output
No extraction yet
Paste HTML and CSS, then choose a viewport and extract.
Critical CSS Extractor measures which elements fall above the fold in your browser and keeps only the CSS rules that match them. It preserves :root, keyframes and font faces, filters media queries against the selected viewport, reports unmatched selectors as dead-CSS candidates, and lets you merge runs from desktop and mobile viewports. The output is the Filament Group pattern: an inline critical <style> block, a preload/onload link for the full stylesheet, and an optional noscript fallback.
Examples
Above-the-fold hero
<header class='hero'>Hi</header> · .hero { color: red } .footer { color: blue }only .hero inlinedThe footer rule is reported as unmatched — it can stay in the deferred stylesheet.
Mobile media query
@media (min-width: 768px) { .btn { padding: 16px } } at 375px wideblock skipped and listedAt mobile width the desktop block cannot affect first paint, so it is deferred with the full sheet.
Union across viewports
Desktop run + mobile runone merged critical blockRe-running at another viewport adds only new rules, keeping the final inline block compact.
About this tool
Critical CSS Extractor solves render-blocking stylesheets without a Node build step. Paste a page's HTML and CSS, choose a viewport, and the tool keeps only the rules whose selectors match elements above the fold. Elements are measured with the browser's own layout engine; matching and emission happen locally, so nothing is uploaded.
The extractor walks style rules and media blocks, keeps :root, body, font-face and keyframe rules unconditionally, and preserves pseudo-class variants of matched base selectors such as .btn:hover. Media queries are evaluated against the chosen viewport width, and skipped blocks are listed so you can see exactly what was deferred. Unmatched selectors are surfaced as dead-CSS candidates for later pruning.
Output follows the proven inline-then-preload pattern: a <style> block with critical rules, a link rel=preload that swaps to a stylesheet on load, and an optional noscript fallback. Run at desktop and mobile sizes and the tool unions the results, so one inline block covers both. Copy a snippet or download a complete rewritten HTML document.
What this tool does not do
- Only pasted HTML and CSS are analyzed — remote stylesheets and images are never fetched, so input must contain the full markup and styles.
- Above-the-fold measurement uses your browser's layout engine; fonts or scripts loaded later can shift elements and change which rules are needed.
- The selector matcher covers common tag/id/class/attribute patterns; exotic selectors should be reviewed in the unmatched list before pruning.
How to use this tool
Paste HTML and CSS
Paste a page's markup and its stylesheet. Existing <style> blocks inside the HTML are picked up automatically; remote URLs are never fetched.
Choose a viewport
Pick desktop, mobile or tablet. Above the fold means any element intersecting the viewport rectangle.
Extract and repeat
Run the extraction, switch viewport, and run again — the tool merges the critical rules from every run.
Copy the snippet
Copy the inline style plus preload/noscript pattern, or download a full HTML document with the snippet in its head.
Use cases
WordPress and CMS themes
Improve Lighthouse scores without a build pipeline by pasting a rendered page and its theme stylesheet.
Static sites
Eliminate render-blocking stylesheets on landing pages while keeping the full sheet for below-the-fold content.
Dead CSS cleanup
Review the unmatched selector list to find rules no above-the-fold element uses before pruning a stylesheet.
Output anatomy
| Piece | Purpose |
|---|---|
| <style>…</style> | Critical rules for above-the-fold content |
| link rel=preload as=style | Fetch the full stylesheet without blocking paint |
| onload rel=stylesheet | Apply the full sheet once it arrives |
| <noscript> | Fallback for browsers without JavaScript |
| Skipped media blocks | Rules deferred because their width query did not match |
| Unmatched selectors | Dead-CSS candidates reported for pruning |
The extractor selects rules by usage; it does not minify them. Pair it with a minifier only after extraction.
Common mistakes
Mistake:Inlining the whole stylesheet because it looks small.
Fix:Inlining everything still delays parsing on slow devices. Extract only above-the-fold rules and preload the rest.
Mistake:Forgetting that critical CSS is viewport-specific.
Fix:Run at your key breakpoints and merge the results — one inline block can cover desktop and mobile.
Mistake:Expecting hover and keyframe rules to be dropped as unused.
Fix:Pseudo variants of matched bases and global at-rules are kept intentionally; removing them breaks interactions and animations.
Frequently asked questions
How is above the fold determined?
Your browser lays out the pasted HTML at the chosen viewport size, and an element is above the fold when its bounding rectangle intersects the viewport: its top is above the viewport height and its bottom is below zero. Change the viewport preset and extract again to cover another device class; the tool unions the rules from every run.
Are :hover rules and keyframes kept?
Yes. A pseudo-class rule like .btn:hover is kept when its base selector .btn matches an above-the-fold element, because the interaction can happen without scrolling. @keyframes, @font-face, :root and body rules are kept unconditionally — dropping them would break animations, fonts and global styles even if no single element visibly matched.
What happens to media queries?
Blocks are evaluated against the selected viewport width: min-width and max-width constraints that do not apply are skipped and listed in the results, while matching blocks have their used rules inlined inside the media wrapper. Run at each breakpoint you care about so the merged output includes rules for all of them.
Can it fetch my page URL?
No. The extractor is paste-only and never makes network requests. That is a deliberate privacy stance: your HTML and CSS stay in the tab. Paste a saved copy of the rendered page and its stylesheet — including any <style> blocks — and the tool measures them locally.
Does the output work with WordPress?
Yes. Paste a rendered page from your theme and its compiled stylesheet, then add the resulting <style> block and preload link to your theme's <head>. The noscript fallback keeps the full stylesheet working for visitors without JavaScript. WordPress-specific caching or minification plugins can stay enabled; just make sure the inlined rules match the final rendered markup.
Is this a CSS minifier?
No. Minifiers shrink code; this tool selects which rules are needed for first paint. The two are complements: extract critical CSS first, then optionally minify both the inline block and the deferred stylesheet. The unmatched selector list can also help you prune genuinely dead CSS before minification.
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.gitattributes Generator
Build .gitattributes rules for line endings, Git LFS, GitHub linguist marks and merge drivers — with a one-line explanation for every rule.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.