User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
Category CSS Tools
0 characters
CSS Output
Decoded CSS will appear here
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Base64 encoding inflates CSS file size by approximately 33% compared to raw text. Embedded stylesheets using data:text/css;base64,... URIs bypass additional HTTP requests but obscure the underlying rules from inspection and debugging. Misidentifying a corrupted Base64 payload - a single missing pad character (=) or an illegal byte - produces silent rendering failures where styles simply vanish without browser console errors. This tool decodes Base64 strings back to readable CSS, validates the input encoding, and applies syntax formatting so you can audit every selector, property, and value before deployment.

The converter handles both raw Base64 strings and full data URI schemes. It strips the data:[mediatype];base64, prefix automatically before decoding. Note: this tool assumes UTF-8 encoded CSS input. Multi-byte characters outside the ASCII range that were incorrectly encoded at source will produce garbled output - always verify the original encoding chain. Pro tip: if you are extracting Base64 CSS from a bundled JavaScript file, ensure you capture the complete string including trailing = padding characters.

base64 css converter decoder data-uri stylesheet base64-decode css-tools

Formulas

Base64 encodes binary data by mapping every 3 bytes (24 bits) to 4 ASCII characters from a 64-character alphabet. The encoded output size is calculated as:

Sencoded = 4 โ‹… ceil(Soriginal3)

where Soriginal = size of the raw CSS in bytes, and Sencoded = resulting Base64 string length in characters. The overhead ratio converges to exactly 43 1.333, yielding the fixed 33.3% inflation.

The decoding process reverses this mapping. Each Base64 character is converted to its 6-bit index value. Four characters produce 24 bits, which split into 3 original bytes:

byte0 = (idx0 ยซ 2) | (idx1 ยป 4)
byte1 = ((idx1 & 0xF) ยซ 4) | (idx2 ยป 2)
byte2 = ((idx2 & 0x3) ยซ 6) | idx3

where idxn = the 6-bit integer value of the n-th Base64 character. Padding characters (=) signal that the final group contains fewer than 3 bytes: one = means 2 bytes remain, two = means 1 byte remains.

Reference Data

Data URI PrefixMedia TypeUse CaseSize Overhead
data:text/css;base64,CSS StylesheetInline <link> or @import33%
data:text/html;base64,HTML DocumentIframe sources33%
data:application/json;base64,JSONConfig embedding33%
data:image/png;base64,PNG ImageCSS background-image33%
data:image/svg+xml;base64,SVG VectorIcons, logos33%
data:font/woff2;base64,WOFF2 Font@font-face embedding33%
data:application/javascript;base64,JavaScriptScript embedding33%
data:text/plain;base64,Plain TextGeneric text data33%
data:image/jpeg;base64,JPEG ImagePhoto embedding33%
data:image/webp;base64,WebP ImageModern image format33%
Base64 Character Set (RFC 4648)
Index RangeCharactersCountPurpose
0 - 25A - Z26Uppercase alphabet
26 - 51a - z26Lowercase alphabet
52 - 610-910Digits
62+162nd value
63/163rd value
- =0 - 2Padding (mod 3 alignment)
Encoding Size Examples
Original CSS SizeBase64 Encoded SizeOverheadPadding Chars
1 KB1.37 KB370 B0 - 2
5 KB6.83 KB1.83 KB0 - 2
10 KB13.65 KB3.65 KB0 - 2
50 KB68.27 KB18.27 KB0 - 2
100 KB136.53 KB36.53 KB0 - 2

Frequently Asked Questions

The converter automatically detects and strips any data URI prefix matching the pattern data:[mediatype];base64, before decoding. You can paste the full data URI or just the raw Base64 payload - both produce identical CSS output. The stripped prefix is discarded since it carries no stylesheet data.
All whitespace characters (spaces, tabs, newlines, carriage returns) are silently stripped before validation and decoding. This is necessary because many systems split Base64 into 76-character lines per RFC 2045 (MIME). The tool normalizes the input regardless of line-wrapping format.
This typically indicates an encoding mismatch. The tool assumes the original CSS was encoded as UTF-8 before Base64 conversion. If the source used Latin-1, Shift-JIS, or another encoding, multi-byte sequences will not decode correctly. Verify the encoding chain at the source. Another common cause is an incomplete Base64 string - truncation corrupts the final byte group.
This tool is a one-directional decoder: Base64 to CSS. Encoding CSS to Base64 requires the inverse operation (btoa in JavaScript). A dedicated CSS-to-Base64 encoder would be the appropriate tool for that direction.
The converter runs entirely in the browser. Practical limits depend on the device's available memory. The native atob function handles strings up to several megabytes reliably on modern browsers. For CSS files exceeding 5 MB in encoded form, expect noticeable decode latency. The tool displays input and output byte sizes for your reference.
No. Syntax highlighting is purely visual - applied via HTML <span> elements in the display layer only. The underlying decoded CSS string remains untouched. When you copy or download the output, you receive the raw decoded CSS text with no highlighting markup.
The beautifier uses a brace-matching state machine. It tracks nesting depth by counting { and } characters while respecting string literals and comments. Each nested block increases indent by 2 spaces. Semicolons trigger line breaks. The algorithm does not parse CSS semantics - it formats based on structural tokens only, which means malformed CSS will still be formatted but may look unusual.