No Login Data Private Local Save

Critical CSS Extractor - Online Inline Above‑the‑Fold Styles

7
0
0
0

Critical CSS Extractor

Extract above‑the‑fold CSS from your stylesheets. Inline critical styles to boost First Contentful Paint and improve Core Web Vitals. Paste your HTML & CSS below, set the viewport, and get the critical CSS instantly.

Height defines the "fold" line
0 characters Full document or fragment supported
0 characters External CSS? Paste it directly here
Analyzing...
Original CSS Size
Critical CSS Size
Size Reduction
Rules Extracted

                

                
The dashed line indicates the fold at 667px

Frequently Asked Questions

What is Critical CSS and why does it matter?

Critical CSS refers to the minimum set of CSS rules required to render the above‑the‑fold portion of a web page — the content visible before any scrolling. By inlining these styles directly into the <head> of your HTML and deferring the rest, you eliminate render‑blocking CSS requests. This dramatically improves First Contentful Paint (FCP) and Largest Contentful Paint (LCP), two key Core Web Vitals metrics that affect SEO rankings and user experience.

How does this Critical CSS Extractor work?

This tool renders your HTML and CSS inside a sandboxed iframe at the viewport dimensions you specify. It then:

  1. Scans all elements positioned above the fold line (viewport height).
  2. Iterates through every CSS rule in your stylesheet(s).
  3. Matches selectors against above‑the‑fold elements using the browser's native querySelectorAll.
  4. Collects matching rules while preserving @font-face, :root variables, and applicable media queries.
  5. Outputs the minimal critical CSS you need for instant first‑paint rendering.

All processing happens locally in your browser — your code is never sent to any server.

What viewport size should I use for extraction?

Choose the viewport that matches your primary audience:

  • Mobile-first: 375×667 (iPhone SE) or 390×844 (iPhone 14) — mobile traffic dominates most websites.
  • Tablet: 768×1024 (iPad) — useful for content-heavy sites with significant tablet traffic.
  • Desktop: 1440×900 — if your analytics show predominantly desktop users.

For best results, extract critical CSS at your most common viewport and consider generating separate critical CSS files for mobile and desktop if your layouts differ significantly.

What's the difference between Critical CSS and Unused CSS removal?

Critical CSS focuses specifically on styles needed for the initial viewport (above‑the‑fold). It may include rules that apply to content further down the page if those rules also style above‑the‑fold elements. Unused CSS removal (like PurgeCSS) strips any rule that doesn't match any element on the entire page. Critical CSS is a subset optimization for render‑blocking resources; unused CSS removal is a broader size optimization. They complement each other — use both for maximum performance.

How do I implement Critical CSS on my website?

The standard pattern:

  1. Extract critical CSS using this tool.
  2. Inline the critical CSS inside a <style> tag in your <head>.
  3. Defer the full CSS using <link rel="preload"> with an onload handler:
    <link rel="preload" href="full.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
  4. Include a <noscript> fallback for users with JavaScript disabled.

The "Optimized HTML" tab in this tool generates a ready‑to‑use template following this pattern.

Can Critical CSS improve my Core Web Vitals scores?

Yes — significantly. By inlining critical CSS:

  • FCP (First Contentful Paint) improves because the browser doesn't wait for external CSS files before painting.
  • LCP (Largest Contentful Paint) improves because hero images and headlines render immediately.
  • TBT (Total Blocking Time) may decrease since CSS parsing no longer blocks the main thread for as long.

Many sites see FCP improvements of 0.5–1.5 seconds after implementing critical CSS, especially on slower connections.

Does this tool handle media queries and responsive styles?

Yes. The extractor evaluates @media queries against the current viewport settings. Media queries that match your selected viewport are processed and their critical rules are included. Media queries that don't match are skipped. This ensures your critical CSS is optimized for the target viewport while keeping responsive behavior intact for that specific breakpoint.

How much CSS is typically critical?

For most websites, critical CSS ranges from 5–25 KB (uncompressed), which is a fraction of the total stylesheet. After gzip compression (which most servers apply), this often shrinks to 2–8 KB — small enough to inline without bloating the HTML. If your extracted critical CSS exceeds ~30 KB, consider whether your above‑the‑fold design is too complex or if you're including unnecessary rules.