It is worth considering, but you should not move all your CSS into HTML. According to web.dev, inlining the critical CSS needed for the initial viewport in the document head and loading the remaining styles asynchronously can improve initial loading when the browser has not yet cached the relevant resources. This depends on correct implementation. However, inlining increases HTML size and may sacrifice the benefits of reusing cached styles across pages. Base the decision on measured performance and maintenance difficulty rather than applying the technique to every site.
It reduces the wait for above-the-fold styles, not all loading costs
Critical CSS consists of the styles needed to render content visible in the initial viewport, not the styles for the entire page. Downloading external CSS can delay First Contentful Paint (FCP). Placing the necessary styles directly in the HTML eliminates the network request needed to fetch that portion of the CSS, while the remaining styles load asynchronously.
For example, if only the navigation bar, heading, and opening text are visible when a page opens, extracting critical CSS should focus on rendering those elements correctly, rather than including styles for every component on the page. This is only a guide, though: you still need to check what appears above the fold in each target viewport. Do not assume it will be the same on every screen.
Account for larger HTML and cross-page caching
Inlining does not reduce the amount of CSS data; it moves that data into the initial HTML response. web.dev notes that HTML often cannot be cached for long, or cannot be cached at all. As a result, large amounts of inlined styles may not be reusable from cache on subsequent pages as an external stylesheet would be.
- Before the relevant resources are cached: eliminating the request for critical styles may improve initial loading.
- When browsing subsequent pages: shared styles sent with each page’s HTML are transferred repeatedly.
- When evaluating: do not just count the request eliminated; also measure the increase in HTML size and actual page performance.
Extraction scope and deferred loading affect ongoing maintenance costs
The challenge goes beyond selecting styles the first time. Questions raised by web.dev include which viewport sizes to support, whether extraction can be automated, and what users will see if they scroll down before the non-critical CSS has loaded.
Areas whose styles have not yet loaded may briefly appear without styling, known as a flash of unstyled content (FOUC). Checking that the initial viewport looks correct is therefore not enough to confirm that the approach works. You should also test different target viewports and scenarios where users scroll early. Some site architectures make extraction and maintenance too difficult; in other cases, the performance gains may still justify the effort. There is no one-size-fits-all answer.
Font declarations can be inlined; font files are a different matter
According to web.dev, inlining render-blocking CSS containing @font-face declarations in the head allows the browser to discover fonts earlier and download only those needed for the current page. However, if an external render-blocking stylesheet remains, font downloads must still wait for that stylesheet to load. Earlier discovery therefore does not mean immediate downloading.
This does not mean the font files themselves should be inlined. Doing so is not recommended because Base64 encoding increases the amount of data transferred and may also delay the preload scanner’s discovery of other critical resources.
Inlining critical CSS: perspectives from across the web
How can you decide which resources to prioritize?
Start by checking the “Eliminate render-blocking resources” diagnostic in the PageSpeed Insights report to review the listed resources and estimated time savings. Then identify resources that are not essential to the site's functionality and consider removing, inlining, or deferring them. The diagnostic is a starting point for investigation, not a recommendation to inline every listed resource. If you are unfamiliar with web development, you may need a developer's help.
How does inlining font declarations differ from preloading fonts?
Inlining @font-face declarations allows the browser to discover fonts earlier and download only those needed to render the current page. By contrast, preload hints may download fonts that the current page does not use. However, even with inlined declarations, if an external render-blocking stylesheet remains, font downloads must still wait for that stylesheet to load. Earlier discovery therefore does not mean immediate downloading.
References
- Optimize resource loadingweb.dev — Source used in the article above.
- Optimize web fontsweb.dev — Discusses: How does inlining font declarations differ from preloading fonts?
- Google PageSpeed Insights: What It Is & How to Boost Your Scorewww.semrush.com · 2023-07-10T09:40:00Z — Discusses: How can you decide which resources to prioritize?




