Stays in your browser
Base64 Encode / Decode Online
Free Base64 encoder and decoder. Convert between plain text and Base64 for tokens, data URIs, and API payloads.
When Base64 is the right tool
Base64 exists for one reason: to move bytes through channels that only accept printable ASCII. JSON, HTTP headers, HTML attributes, XML, and email bodies all break or mangle raw binary, so the bytes are re-encoded into a 64-character alphabet that survives every one of those transports. It is a transport encoding, not a storage format.
The most common mistake is treating Base64 as protection. Anyone can decode it, and its output is only about 33% larger than the input. If you need to keep data secret, the answer is encryption with a key you control, and Base64 is what you wrap the ciphertext in afterwards, nothing more.
The second most common mistake is wrapping at the wrong width. Many decoders, especially older ones, expect line breaks every 76 characters, while most modern APIs want a single unbroken string. Knowing which one your consumer expects saves an afternoon of debugging a payload that looks correct.
FAQ
- What is Base64?
- Base64 encodes binary or text as safe ASCII—common in email, tokens, and data URIs.
- Is Base64 encryption?
- No. Base64 is encoding, not encryption, and is easily reversed.
- Does it support Unicode?
- Yes. Text is UTF-8 encoded before Base64, so multi-byte characters work correctly.
- Why does Base64 make my data bigger?
- Base64 represents every three bytes with four ASCII characters. That is a fixed 4/3 expansion, so a 1 MB image becomes roughly 1.37 MB, and the effect is much larger if the result is then stored as UTF-8 or JSON-escaped. Sending binary as Base64 is convenient, never efficient.
- How do I Base64 encode an image or a file?
- Encode the raw bytes, not the filename. For a web page you then wrap the result as a data URI such as data:image/png;base64,... which the browser renders inline. For anything larger than a few kilobytes, serving the file normally is faster, because data URIs cannot be cached separately.
- Why do some Base64 strings end with one or two equals signs?
- Those are padding. Base64 output is measured in groups of four characters, so when the input length is not divisible by three the encoder appends = characters to fill the last group. They carry no information; some decoders accept a string without them, and some do not.