b2KIT

Above-the-Fold CSS Extractor

Paste your CSS and HTML to extract above-the-fold critical CSS. Generates inline styles and deferred stylesheet loading code.

Tested tool guide Tested browser tools Checked August 16, 2026

What Above-the-Fold CSS Extractor does and how it behaves

You paste your full CSS and the page's HTML, then set an assumed viewport height (most people leave it around 600-800px for a typical laptop or tablet fold). The tool walks the markup in document order, estimating each element's height from declared dimensions, line-height, margin and padding values it finds in your stylesheet, and marks everything before that running offset crosses the viewport as above the fold. It pulls the matching selectors into an inline <style> block and rewrites the rest to load asynchronously. Because there's no live rendering, JavaScript-driven layout, web-font swaps, and flexbox/grid reflow can shift the real fold away from this estimate.

How the result is produced

1

Fold estimation

The tool reads the HTML top to bottom and keeps a running vertical offset, adding each element's estimated height from any inline width/height attributes plus the line-height, margin, and padding values it can find for that selector in the pasted stylesheet. Once the offset crosses the viewport height you specify, everything before that point in document order counts as above the fold; anything after it is treated as deferred content.

2

Split and output generation

Selectors that match an above-fold element are copied into a compact inline stylesheet meant for the document head; everything else is written back out as an external file reference wrapped in a rel=preload tag with an onload handler that swaps it to rel=stylesheet, plus a noscript fallback so browsers without JavaScript still load the full stylesheet normally.

Good uses

  • shaving render-blocking CSS off a landing page ahead of a Lighthouse or PageSpeed Insights run
  • pulling critical styles for a hero section out of a large theme stylesheet before a campaign launch
  • preparing an inline-critical-CSS snippet for a static site generator that has no build-time critical CSS step

Limits and checks

  • The fold estimate is a document-order heuristic, not a rendered measurement - it won't know that a sidebar, absolutely-positioned banner, or CSS grid area actually sits higher or lower on screen than its markup position suggests.
  • Styles applied by JavaScript after load (class toggles, framework hydration state, lazy-loaded widgets, cookie-consent banners) aren't present in the pasted HTML, so their CSS gets excluded from the critical block even if they render immediately on a real visit.
  • One viewport height covers a single breakpoint only - a fold estimate set for a 1280x800 desktop view won't match what's actually visible on a 375px-wide phone or a 1024px tablet, so mobile and desktop layouts need separate runs with different heights.

Common questions

Does it actually render my page to find the fold, like a headless browser would?

No - it estimates position from HTML order and the box-model values it can read out of your pasted CSS, without loading fonts, images, or executing JavaScript. Treat the output as a starting point and confirm the real fold with browser DevTools or a Lighthouse trace before shipping.

Can I just paste minified CSS and my whole page's HTML?

Yes, minified CSS parses fine, but very large stylesheets or documents may need trimming to the section you actually want checked. Matching happens by selector, so obfuscated, hashed, or dynamically-generated class names may not connect back to the right rules in your CSS.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools