rembrembdocs

inlineCss

This feature is currently experimental and subject to change, it's not recommended for production. Try it out and share your feedback on GitHub.

Last updated April 23, 2026

Usage

Experimental support for inlining CSS in the <head>. When this flag is enabled, all places where we normally generate a <link> tag will instead have a generated <style> tag.

next.config.ts

JavaScriptTypeScript

import type { NextConfig } from 'next'
 
const nextConfig: NextConfig = {
  experimental: {
    inlineCss: true,
  },
}
 
export default nextConfig

Trade-Offs

When Inline CSS Helps

Normally, the browser must download HTML, parse it, discover CSS <link> tags, then request stylesheets before it can render. Inlining eliminates this request waterfall, so that styles arrive with the HTML, so the browser can render immediately.

This benefit is strongest with:

When External CSS is Better

Inlined styles cannot be cached separately from HTML. Every page load re-downloads the same CSS.

This trade-off matters most with:

Good to know:

This feature is currently experimental and has some known limitations:

  • CSS inlining is applied globally and cannot be configured on a per-page basis
  • Styles are duplicated during initial page load - once within <style> tags for SSR and once in the RSC payload
  • When navigating to prerendered pages, styles will use <link> tags instead of inline CSS to avoid duplication
  • This feature is not available in development mode and only works in production builds

Was this helpful?