CSS to Base64
Turn stylesheets into Base64 data URIs and decode them back to CSS.
CSS to Base64 Encoder and Data URI Generator
This tool encodes CSS stylesheets to Base64 and generates data:text/css;base64,... URIs, and it decodes Base64 back into readable CSS. It's handy when you need a stylesheet that travels with the page instead of living in a separate file.
Stylesheets without a file
Enable Output as data URI and drop the result into a link element:
<link rel="stylesheet" href="data:text/css;base64,Ym9keXttYXJnaW46MH0=">
That string is just body{margin:0}. The browser applies it exactly like a stylesheet served from your domain. The same URI works with @import url("data:text/css;base64,...") inside another stylesheet, and with JavaScript that creates a <link> element dynamically, a common technique in bookmarklets, browser extensions, and embeddable widgets that must not depend on external hosting.
Why not just use a style tag?
A <style> block is simpler for a single page, but a data URI is sometimes the only option: when a system accepts only a stylesheet URL (many site builders, theme settings, and ad or email platforms), when you generate single-file HTML reports, or when a style must be passed as one attribute value through a template engine. Base64 also avoids escaping problems with quotes, </style> sequences, and non-ASCII characters in content: "→" rules.
Decoding embedded CSS
Minified bundles, email templates, and exported HTML sometimes contain long data:text/css;base64 strings. Paste one into Base64 to CSS and the original rules come back, ready to review or download as a .css file.
Tips
Minify CSS before encoding to keep the URI short, and keep data-URI stylesheets small since they can't be cached independently. For fonts and background images inside the CSS, encode the image itself with Image to Base64. To embed markup instead, use HTML to Base64.
Frequently Asked Questions
How do I load a Base64 stylesheet with a link tag?
Enable 'Output as data URI' and use the result as the href: <link rel="stylesheet" href="data:text/css;base64,...">. The browser treats it like any external stylesheet, but no network request is made.
Will a Content Security Policy block data: stylesheets?
It can. If your CSP has a style-src directive, data: must be listed explicitly (style-src 'self' data:) for data URI stylesheets and @import rules to load. Inline <style> blocks are controlled separately by 'unsafe-inline', nonces, or hashes.
Is Base64 CSS smaller or faster?
No, it is about 33% larger than the plain CSS and can't be cached as a separate file. It pays off only when saving a request matters more than size, for example in single-file HTML exports, widgets, and emails.