Base64 turns arbitrary bytes into 64 printable characters so they can travel through channels that only accept text: an email body, a JSON field, a YAML config, a URL. This page does that conversion in both directions, for a pasted string or for a file, without sending anything anywhere.
What the conversion actually costs
Base64 is not compression — it is the opposite. Every three bytes of input become four characters of output, so the result is four thirds the size of what went in, plus padding. A 3 MB image becomes about 4 MB of text. That overhead is the price of being able to put binary data somewhere only text is allowed, and it is worth knowing before you inline a large asset into a stylesheet.
| Input | Output | Growth |
|---|---|---|
| 3 bytes | 4 characters | 133% |
| 1 KB | 1,368 characters | 133% |
| 1 MB | ~1.37 MB | 133% |
Text mode and file mode
Text mode converts as you type and is meant for the everyday case: a token segment you need to read, a config value, a short string. It is capped at 1 MB, which is a limit on what a text box can render smoothly rather than on the encoder.
File mode is for everything else. The file is read as a stream and converted piece by piece, which is why a large file does not lock up the tab: the work happens off the main thread and the page keeps responding while a progress bar moves. You get a preview of the first part of the result and a Download button for the whole of it.
Standard versus URL-safe
The two alphabets differ in exactly two characters, the ones at positions 62 and 63:
| Position | Standard | URL-safe |
|---|---|---|
| 62 | plus | hyphen |
| 63 | slash | underscore |
Everything else is identical, so a value that happens to contain neither is the same in both. That is what makes the mismatch so easy to miss: a short string encodes identically under both alphabets and a longer one silently does not. When decoding, this tool accepts both without being told which is which, so a token pasted from anywhere just works.
Padding
The equals signs at the end are not data. Base64 emits four characters per three input bytes, and when the input does not divide evenly the last group is short:
f(1 byte) becomesZg==fo(2 bytes) becomesZm8=foo(3 bytes) becomesZm9v, with nothing to pad
Some systems require the padding, others reject it, and JWTs omit it entirely. The toggle controls what gets written; the decoder does not care either way.
Data URIs
Turning on the data URI option while encoding a file wraps the result with the prefix a browser
needs to treat it as an inline resource, and fills in the file type for you. The result can be
pasted directly into a CSS background-image or an HTML img tag. Decoding is symmetric: paste
a whole data URI and the prefix is recognised and stripped before the payload is decoded.
Inlining is a real trade-off. It removes a network request, which is why small icons are often inlined, but it also grows the file that carries it by a third and it cannot be cached separately. Below a few kilobytes it usually wins; above that it usually does not.
When decoding fails
Two things can go wrong, and the tool distinguishes them:
- An invalid character. Something in the input is not part of either alphabet. The position is reported so you can look straight at it — most often a stray quote, an ellipsis from a word processor, or a fragment of the surrounding JSON that got selected along with the value.
- A length that cannot work. Base64 is only valid at certain lengths, and one of the remainders is impossible. This nearly always means the value was truncated in transit.