Start a project

Tool 54 of 194 · CSS

Critical CSS Extractor

Paste a page and its CSS to get the critical rules for the first screen on phones and desktops, the deferred remainder and a ready head snippet.

Critical CSS Extractor at a glanceIllustration: 1, HTML and CSS; 2, processed in your browser; 3, Critical CSS.Critical CSS Extractor</>1HTML and CSS3Critical CSS2In yourbrowser
1 HTML and CSS 2 processed on your device 3 Critical CSS

Critical CSS Extractor

Your page and stylesheet

    Preview

    The red dashed line is the fold for the last viewport rendered. Scripts and remote images don't load.

    Critical CSS

    Inline this in the head

    Deferred CSS

    Load this later

    Head snippet

    Paste into the head

    Every rule

    RulePhoneDesktop

    01

    What it does

    Renders a page at phone and desktop sizes, keeps the CSS rules that style anything above the fold, and splits the stylesheet in two.

    • Rendered in a real browser frame at 390×844 and 1350×940, or both combined
    • Rules kept when they match anything visible in the first viewport
    • @media, @supports and @layer wrappers preserved, layer order statements kept
    • @font-face and @keyframes kept only when critical rules use them

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Critical and deferred CSS files, a head snippet, sizes and a per-rule breakdown, with a Copy and a Download button on every result.

    • CSS
    • Performance
    • Critical CSS
    • Core Web Vitals

    Why it matters

    Every stylesheet in the head blocks rendering: the browser shows nothing until it has downloaded and parsed all of them, even though the first screen needs a fraction of the rules. Inlining that fraction, the critical CSS, and loading the rest without blocking can take a whole round trip off First Contentful Paint on mobile. Tools that do this usually need Node and a headless browser in your build.

    This extractor renders your page in a sandboxed frame at a phone size, a desktop size or both, finds every element visible in the first viewport, and keeps each style rule that matches one of them, evaluated by the browser itself, inside its @media, @supports and @layer wrappers. Rules for states such as :hover count when the element is on screen, @layer statements are kept so the order doesn't change, and @font-face and @keyframes are kept only when a critical rule uses them. You get the critical CSS, the deferred remainder, a head snippet that inlines one and loads the other without blocking, and the sizes compared with the roughly 14 KB that fits in the first round trip.

    How it works

    1. InputYour page's HTML and full stylesheet
    2. In your browserRendered at phone and desktop widths; rules that paint above the fold kept
    3. OutputInline critical CSS, the deferred rest and the loading snippet

    Where it fits in a designer's workflow

    1. Plan
    2. Design
    3. Build
    4. Test
    5. Launch
    Speeding up first paint on a page with one render-blocking stylesheet.

    By the numbers

    Rules needed for the first screen of the sample page, by viewportCritical at 390px (phone): 16 rules; Critical at 1350px (desktop): 14 rules; Critical at either width: 17 rules; All rules in the stylesheet: 26 rulesCritical at 390px (phone)16 rulesCritical at 1350px (desktop)14 rulesCritical at either width17 rulesAll rules in the stylesheet26 rules
    Found by this tool in its sample: 17 of 26 rules are needed above the fold (390px: 14 of 30 elements visible; 1350px: 18 of 30 elements visible). Critical CSS 1.2 KB of 1.7 KB. The phone and desktop folds need different rules (the menu toggle on phones, the nav on desktop), so the extractor keeps the union. Inline the critical part (1,253 bytes here) and load the rest without blocking render; keep the inline block well under the first 14 KB round trip. Source: web.dev: Extract critical CSS; web.dev: Defer non-critical CSS.
    Show the numbers as a table
    Rule390×8441350×940
    @layer base, components;CriticalCritical
    @font-faceCriticalCritical
    @font-faceCriticalCritical
    @layer base › htmlCriticalCritical
    @layer base › bodyCriticalCritical
    @layer base › h1, h2CriticalCritical
    @layer base › imgDeferredDeferred
    @layer components › .site-headerCriticalCritical
    @layer components › .navDeferredCritical
    @layer components › .menu-toggleCriticalDeferred
    @layer components › .heroCriticalCritical
    @layer components › .btnCriticalCritical
    @layer components › .featuresCriticalCritical
    @layer components › .gridCriticalCritical
    @layer components › .featureCriticalCritical
    @layer components › .reviewsDeferredDeferred
    @layer components › .quoteDeferredDeferred
    @layer components › .newsletterDeferredDeferred
    @layer components › .newsletter inputDeferredDeferred
    @layer components › .site-footerDeferredDeferred
    @media (max-width: 600px) › .navDeferredDeferred
    @media (max-width: 600px) › .menu-toggleCriticalDeferred
    @media (max-width: 600px) › .heroCriticalDeferred
    @media print › .site-header, .site-footerDeferredDeferred
    @keyframes riseCriticalCritical
    @keyframes spinNot animated above the foldNot animated above the fold

    How to use it

    1. Paste the page's HTML and its stylesheet.
    2. Choose phone, desktop or both.
    3. Check the preview and the rules kept.
    4. Copy the critical CSS, the deferred CSS and the head snippet.

    FAQ

    What is critical CSS?

    The CSS needed to render what's visible before scrolling. Inlined in the head, it lets the browser paint the first screen without waiting for the full stylesheet.

    Why 14 KB?

    A new connection can send about ten TCP packets, roughly 14 KB, before waiting for an acknowledgement. HTML plus inlined CSS under that size arrives in the first round trip.

    Why both phone and desktop?

    Different layouts show different things above the fold. The union covers both, so neither flashes unstyled content when the rest loads.

    Is the onload trick safe with a strict CSP?

    The snippet's onload attribute is inline script, which a strict Content Security Policy blocks. Use a small external script to switch the stylesheet's media to all, or a hash.

    What can it miss?

    Content added by scripts after load, such as an open menu or a cookie banner, isn't in the preview. Add its HTML to the page you paste if it shows on the first screen.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk