Why You Must Inline CSS in HTML Emails (and How to Do It)
If you've ever built HTML emails manually, you've probably had this unpleasant surprise: your email looks perfectly styled in the browser, but all styles disappear once received in Gmail or Outlook.
The cause? You put your CSS in a <style> tag in the <head> — as every web developer does. But in the email world, this practice simply doesn't work. This guide explains why, and how to solve the problem once and for all.
Table of Contents
1. What is CSS inlining?
CSS inlining means placing style declarations directly in the style attribute of each HTML element, rather than in a separate stylesheet or <style> tag.
External CSS (❌ doesn't work in emails):
<style> h1 { color: red; font-size: 24px; } </style>
Inline CSS (✅ works in emails):
<h1 style="color: red; font-size: 24px;">Title</h1>
2. Why email clients strip CSS
Email clients display your email within their own interface, which already has its own CSS. If they allowed your <head> CSS, it could pollute their own styles and break their interface.
- Strip the
<head>entirely (Gmail, Yahoo) — everything in the head, including<style>tags, is removed - CSS parser with limited scope (Apple Mail, Outlook Mac) — CSS is preserved but re-scoped
- Ignore external stylesheets — all email clients ignore
<link>to external CSS files
3. CSS compatibility by email client
- Gmail (web) — strips
<style>tags. Only inline CSS is preserved. - Outlook 2007–2021 (Windows) — strips
<style>. Inline CSS partially preserved. - Apple Mail — excellent CSS support including
<style>and media queries. - Yahoo Mail — strips
<style>. Inline CSS required.
4. Tools to inline CSS automatically
- Juice (Node.js) — widely used open source library.
npm install juice - Premailer — popular Ruby/Rails tool, also available as a web API
- Mailchimp CSS Inliner — free online tool
5. Limits of inline CSS
Even with perfect inline CSS, some CSS properties are simply not supported in emails regardless of where they are placed:
display: flex/grid— ignored by Outlookposition: absolute/fixed— not supportedbackground-image— ignored by Outlook (requires VML)- CSS animations — ignored everywhere except Apple Mail
- Media queries — cannot be inlined (must stay in a
<style>tag)
6. MailBuildr: automatic CSS inlining included
MailBuildr solves this problem at the root: our compiler directly generates HTML with 100% inline CSS, without you having to worry about it. Design your email visually or via an AI prompt, and the engine produces optimized code for all email clients.
- ✅ Generates inline CSS on every element
- ✅ Structures layout with HTML tables (Outlook compatibility)
- ✅ Adds MSO conditional comments when needed
- ✅ Handles VML for Outlook background images
- ✅ Keeps media queries in a scoped
<style>for responsive - ✅ Optimizes generated HTML size (under 100 KB)
No more CSS problems in your emails
MailBuildr generates professional email HTML with automatic inline CSS, compatible with Gmail, Outlook and all major email clients.
Create my first email →7. FAQ
Is inline CSS still required in 2026?
Yes, for maximum compatibility. While Apple Mail and Outlook 365 now better support CSS in the head, Gmail (the most used client) continues to strip <style> tags. Inline CSS remains the only universally reliable approach.
Does my email platform inline CSS automatically?
Most ESPs (Mailchimp, Brevo, Campaign Monitor…) do NOT inline CSS automatically when you import HTML. They send the code as-is. That's why your HTML must already have inline CSS before importing — which MailBuildr does at export time.
Create professional HTML emails without coding
Visual builder, built-in AI, guaranteed Gmail compatibility. Free to start.
Try MailBuildr →