What is a Base64 Encoder / Decoder?
Base64 turns arbitrary bytes into a safe ASCII string, which is why it appears everywhere: basic auth headers, data URIs, email attachments, JWT segments and config files.
This tool encodes and decodes with proper UTF-8 handling, so emoji and non-Latin text survive the round trip: a common failure of naive implementations.
Padding, line breaks and the two alphabets
Base64 has more variation in the wild than its reputation suggests, and the differences are what break a decode that should have worked.
- Padding. The trailing = characters pad the output to a multiple of four. Some decoders require them and some reject them, so if a string fails to decode somewhere else, the padding is the first thing to compare.
- Line breaks. The MIME flavor used by email wraps at 76 characters. A decoder that was written for a single-line string will choke on the newlines rather than ignoring them.
- Alphabet. Standard Base64 uses + and /, which are both unsafe in a URL. Base64URL swaps them for - and _ and usually drops the padding, which is why a JWT segment pasted into a standard decoder can fail on exactly two characters.
The cost of inlining, and when not to
Base64 turns three bytes into four characters, so anything encoded arrives about a third larger, before the extra bytes of the data URI wrapper. For a small icon that is a fair trade against a separate HTTP request. For anything larger it usually is not, and the reasons compound.
An inlined image cannot be cached separately, so every page that embeds it re-downloads it, and it cannot be lazy-loaded or served in a different format to browsers that support one. Worse, inlining into a stylesheet puts the bytes on the critical rendering path: the page cannot paint until the CSS has finished downloading, image and all. Keep data URIs for icons of a few kilobytes, email signatures and self-contained documents, and let real files be real files.
Frequently asked questions
Is Base64 encryption?
No: it is encoding, freely reversible by anyone. Never treat Base64 as a way to hide secrets.
Why does Base64 make data bigger?
It represents every 3 bytes as 4 characters, so output is ~33% larger than input. That is the price of being ASCII-safe.
Does the tool handle emoji and non-English text?
Yes: text is encoded as UTF-8 bytes first, so any Unicode text round-trips correctly.
What is Base64URL?
A URL-safe variant using - and _ instead of + and /. The decoder accepts both.