CSS Inlining for Email: When You Need It, and When You Don't
Write CSS in a <style> block, send the email, and half your clients render it as if the styles were never there. The fix is inlining, but it's widely misunderstood. Here's what it actually does, what it can't, and why you still keep a style block around.
Many email clients strip <style> blocks in the head, rendering emails unstyled unless styles are written directly into inline style="..." attributes. However, @media queries, :hover states, and dark mode overrides cannot be inlined and must remain in an embedded style block.
Why inlining exists
On the web, you put CSS in a stylesheet and elements inherit it. Email clients don't play along. Several, Gmail most famously, strip or ignore <style> blocks in the document head, especially on some mobile and cached views. When that happens, any rule that wasn't written directly on the element vanishes.
Inlining is the workaround: it copies each matching rule onto the element's own style= attribute, where every client reads it. So .btn { color: #fff } plus <a class="btn"> becomes <a class="btn" style="color:#fff">.
What inlining handles for you
- Specificity. When two rules target the same element, the more specific selector wins, an id over a class, a class over a tag, exactly as a browser resolves the cascade. A good inliner flattens that correctly.
!important. Preserved during the merge, so intentional overrides survive.- Shorthand and inheritance. The computed declarations land on the element, so you don't lose values to a stripped stylesheet.
What inlining can't move (and why you keep a style block)
Some CSS has no inline equivalent, because an inline style= attribute styles exactly one element and can't express conditions or states:
- Media queries (
@media), your responsive and mobile-specific styles. - Pseudo-classes and elements (
:hover,::before). @font-faceand keyframe animations.
A proper inliner leaves those in a <style> block rather than dropping them. So the end state is hybrid: most styles inlined for universal support, plus a slim style block for the things that need it. Keep that block, it's what makes your email responsive.
When you don't need to inline by hand
If you build with a framework, inlining may already be happening. MJML and Maizzle inline as part of their build; React Email encourages inline styles from the start. You mostly need a standalone inliner when you're hand-writing HTML, exporting from a design tool, or working with a template that ships a big <style> block.
One caveat worth knowing: inlining repeats declarations onto every element, which inflates your HTML. On large emails that can push you past Gmail's 102KB clip limit, so inline first, then check your size.
Do it in the browser
You can inline any email without a build step: paste it into the CSS inliner, which flattens your styles while preserving media queries. Then confirm the result with the CSS compatibility checker (inlining puts CSS where clients can read it, but doesn't make them support it), keep an eye on weight with the email minifier, and look up any single property in Can I email. For modern utility-first frameworks, read our guide on why Tailwind v4 emails break in Gmail.
Frequently Asked Questions
Why does CSS have to be inlined for HTML emails?
Older and mobile email clients, most notably Gmail across non-Google Workspace/IMAP setups and Yahoo Mail mobile, frequently strip <style> blocks from the document <head>. Inlining moves CSS rules directly into style='' attributes on DOM nodes, guaranteeing that critical layouts and typography render.
What CSS properties cannot be inlined?
CSS pseudo-classes (:hover, :focus), @media responsive queries, keyframe animations, and @font-face rules cannot exist inside an inline style attribute. They must remain in a preserved <style> block in the <head>.
Can CSS inlining cause Gmail clipping?
Yes. Inlining duplicates lengthy style strings across every table cell and paragraph, often increasing raw HTML byte weight by 30% to 50% and pushing emails past Gmail's 102,400 bytes clipping threshold.
Should I inline CSS before or after minifying?
Always inline first, then minify. Inlining generates extra markup and whitespace; running HTML minification afterward strips the redundant whitespace and comments to keep your payload under the 102KB limit.
Inline your email CSS in one paste
Flatten your styles for Gmail and every other client, with media queries preserved, right in your browser.
Open the CSS inliner- •W3C CSS Working Group: CSS Cascading and Style Attribute Specifications
- •Can I Email: Embedded <style> block support comparison across email clients
- •Emailens Engine: CSS Inlining and Head Sanitization Engine
Reviewed by Philippe KAM · Last updated: Sep 6, 2026
Building next-generation email preview and QA infrastructure for developers. Focused on reverse-engineering rendering engines across Outlook (Word MSO & New Outlook), Gmail, and Apple Mail to eliminate email rendering bugs before dispatch.