Base64 to CSS
Paste a Base64 string to get a ready-to-use CSS background-image rule or decoded stylesheet.
Last updated: May 29, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is Base64 to CSS?
Base64 to CSS decodes a Base64-encoded string and produces CSS output. When the decoded data is an image (PNG, JPEG, GIF, WebP), the tool wraps it in a CSS background-image: url(data:...) rule you can paste directly into your stylesheet. When the decoded data is CSS text, it returns the plain stylesheet.
How to Use Base64 to CSS
Paste a Base64 string into the input.
Click "Convert to CSS".
Copy the CSS output and paste it into your stylesheet.
Common Use Cases
- Converting a Base64-encoded PNG or WebP icon into a CSS background-image rule.
- Decoding a Base64-encoded CSS snippet retrieved from an API.
- Generating inline CSS for image assets without a separate HTTP request.
Example Input and Output
A Base64 PNG decoded to a CSS background-image rule.
iVBORw0KGgo=....element {
background-image: url("data:image/png;base64,iVBORw0KGgo=...");
background-repeat: no-repeat;
background-size: contain;
}Privacy
All processing runs in your browser. No data is sent to any server.
Frequently Asked Questions
How does the tool know if the input is an image or CSS text?
It checks the magic bytes of the decoded data. PNG starts with 0x89 0x50, JPEG with 0xFF 0xD8, GIF with "GIF", WebP contains "WEBP" at byte 8. If none match, the decoded text is returned as-is.
Can I use this with SVG Base64?
SVG files do not have recognisable magic bytes as binary data. Use the SVG to Base64 tool to encode, then paste the data URI directly in your CSS.
Related Tools
Base64 Encoder/Decoder
Encode text to Base64 or decode Base64 to plain text — with URL-safe mode, auto-detect, and size stats.
Base64 to Text
Decode Base64 strings back to plain text. Handles UTF-8, URL-safe Base64, and broken padding.
PNG to Base64
Convert a PNG image file to a Base64 string or data URI for embedding in HTML, CSS, or JavaScript.
SVG to Base64
Convert an SVG file to a Base64 string or data URI for embedding in HTML, CSS, or JavaScript.
WebP to Base64
Convert a WebP image file to a Base64 string or data URI for embedding in HTML, CSS, or JavaScript.
Base64 to ASCII
Decode Base64 strings back to ASCII text. Useful for reading HTTP auth headers, API tokens, and encoded config values.

