Skip to content

CSS Inliner for Email

Paste an email with a <style> block and get it back with the CSS inlined, the safest way to make it look right in every email app. Media queries and :hover rules stay in the <style> block, and Outlook gets width, height and bgcolor attributes.

Runs in your browser: the HTML isn’t uploaded or stored.

Options

Paste an email with a <style> block to inline its CSS.

How to use it

Using the css inliner for email

  1. Paste the full HTML of your email, with its CSS in a <style> block.

  2. Choose the options: add width attributes for Outlook, and whether to keep the whole <style> block.

  3. Copy or download the inlined HTML, then check its size with the Gmail clipping checker.

Why email CSS needs to be inline

Not every email app keeps the <style> block. Gmail drops it in some situations — for example in the Gmail app with a non-Gmail account — and some older apps ignore it. Styles written on each element (style="…") work everywhere, so inlining is the safest way to make sure the email looks as designed.

What stays in the <style> block

Media queries, :hover and other states, and rules aimed at a particular email app’s own markup (such as u + #body or [data-ogsc]) can’t be written inline, so they stay in the <style> block for the apps that read it. Rules that match nothing in your email stay as well.

Inline styles win over the <style> block, so the rules inside your media queries need !important to take effect on phones — the usual practice in email.

How conflicts are resolved

When several rules set the same property on an element, the inliner follows the CSS cascade: the more specific selector wins, then the later rule. Styles already written inline keep priority, unless a rule in the <style> block uses !important.

FAQ

Questions, Answered

Does Gmail still need inline CSS?

Gmail supports <style> blocks in most cases, but drops them in some, such as the Gmail app with a non-Gmail account. Inline CSS works in all of them, so it’s still the safe choice for anything that matters.

Will my media queries still work?

Yes. Media queries stay in the <style> block. Because inline styles win over it, the rules inside them need !important to override the inlined styles.

What does “add width, height and bgcolor attributes” do?

Classic Outlook for Windows often ignores CSS widths on tables, cells and images but respects the HTML width attribute. With this option, a CSS width in pixels or percent is also written as a width attribute, and heights and background colours as height and bgcolor, where the element doesn’t already have one.

Does it change anything else in my code?

Your browser reads the HTML and writes it back, so the formatting can change a little: attribute quotes are made consistent, entities such as &copy; become the character itself, and missing closing tags are added. Outlook conditional comments are kept as they are.

Is my HTML uploaded anywhere?

No. It’s inlined in your browser and isn’t uploaded or stored.

Need an HTML email built or fixed?

I code responsive HTML email templates and signatures that work in Outlook, Gmail and Apple Mail, or fix the one you already have. Tell me what you need.

Email me