CSS to Inline Styles
Generate inline style snippets from CSS rules
Input CSS
Inline Style Snippets
What is CSS to Inline Conversion?
Need to convert CSS stylesheet rules into inline style attributes? This tool does exactly that. It takes your CSS rules and converts them into ready-to-use inline style snippets that you can paste directly into HTML elements.
Inline styles are essential when you're working with HTML emails, where external stylesheets are stripped by email clients like Gmail and Outlook. They're also crucial for email testing tools, HTML-to-image converters, and legacy HTML generation systems that don't support linked CSS. This tool automates what would otherwise be tedious manual work.
The converter is deliberately simple. It strips comments, finds each selector { ... } block, splits comma-separated selectors into separate entries and joins the declarations into one style="..." string. Values, vendor prefixes and the !important flag are copied as written, except that double quotes become single quotes so they cannot end the attribute early. It knows nothing about the cascade: @media and other at-rules are left out and listed in a comment, and :hover rules are listed like any other. All of it runs in your browser.
How to Use the CSS to Inline Styles Tool
Nothing to press here: the right panel updates as you edit. You end up with one block per selector, which you paste onto the matching element in your email template by hand.
Paste, Upload, or Load Sample
Paste the rules from your template's <style> block into Input CSS, or Upload a .css file. Sample loads a heading, a button and a 600px container, the usual pieces of an HTML email. A newsletter footer like this one shows the selector-list splitting:
.cta-button {
background-color: #0b6e4f;
color: #ffffff;
padding: 12px 24px;
text-decoration: none;
}
.footer-note, .unsubscribe {
font-size: 12px;
color: #6b7280;
}View Inline Style Snippets
The right Inline Style Snippets panel shows each selector with its style="property: value; ..." format. Copy snippets for HTML elements, email templates, or legacy systems that need inline styles.
Copy or Download
Copy takes every snippet at once. Download saves them as inline-styles.txt, plain text rather than CSS, since each block is a selector line followed by a style attribute. Clear wipes both panels.
When You'd Actually Use This
HTML Email Design
Email clients strip external stylesheets. Build your email design in CSS, then use this tool to convert it to inline styles. Works perfectly with email platforms like Campaign Monitor and Mailchimp.
HTML-to-Image Conversion
Tools that convert HTML to images or PDFs need inline styles because they don't load external CSS files. Convert your stylesheet to inline styles before passing HTML to these converters for perfect rendering.
Legacy System Migration
Migrating from modern web frameworks to legacy systems that only support inline styles? This tool makes the conversion automatic, saving hours of manual style copying and formatting.
Dynamic HTML Generation
Building HTML generators or template systems where you need inline styles for every element? Convert your master CSS once, then reference the inline style snippets throughout your generation code.
Common Questions
Why can't I just link a CSS file in HTML emails?
Most email clients (Gmail, Outlook, Apple Mail) strip <link> and <style> tags for security and consistency. Inline styles are one of the few ways to reliably style email HTML. See Campaign Monitor's CSS support guide for what email clients support.
Will complex selectors be converted?
Every selector is passed through as written, simple or not, and comma-separated lists are split so h1, h2 gives you two snippets. The tool does not judge whether a selector can be inlined: a :hover rule comes out as a snippet like any other, and it is up to you to leave it in a <style> block, because a style attribute has no way to express a hover state.
Can I convert media queries to inline styles?
Not as inline styles; a media query needs a <style> block. The converter leaves every @media block out and names it in a comment at the top of the output, so you know which responsive rules still belong in the template's head.
Does it support shorthand properties?
They are kept exactly as you wrote them. margin: 10px 20px and font: bold 12px Arial stay shorthand; nothing is expanded into longhand. If one email client misreads a particular shorthand, write that rule out longhand before converting.
What about !important declarations?
The !important flag is preserved in inline styles exactly as written. It works the same way - forcing higher specificity and overriding conflicting styles. Use it when you need to ensure styles take precedence.
Is my CSS data stored or analyzed?
No. The conversion is a couple of regular expressions running in this tab, so your CSS is not sent anywhere and there is nothing on our side to keep.