Base64 encode/decode · Guide

Base64 Decode ASCII: Reading Decoded Bytes as Text

Decoding Base64 gives you bytes. Turning those bytes into readable characters is a second, separate step — and "ASCII" is usually the wrong assumption for it.

Two steps, not one

The Base64 layer is unambiguous: four characters in, three bytes out, no interpretation. Whether those bytes are text at all, and in which encoding, Base64 does not record.

So "decode to ASCII" really means "decode to bytes, then interpret the bytes as ASCII". The first step always succeeds on valid input; the second is where things go wrong.

Where ASCII runs out

ASCII covers byte values 0-127 only. Any byte above 127 has no ASCII meaning, so a strict decoder errors and a lenient one substitutes ? or .

UTF-8 is a superset of ASCII: bytes 0-127 mean the same thing, and higher values combine into multi-byte sequences. That is why decoding as UTF-8 is almost always the right default — plain ASCII text decodes identically, and accented or non-Latin text also works.

A concrete case: Y2Fmw6k= decodes to the bytes for "café". As UTF-8 that is correct; as ASCII the last two bytes are undecodable.

When the bytes are not text

Base64 frequently carries images, archives or compressed data. Those decode successfully and then produce garbage in any text encoding, which is expected rather than an error.

Check the first bytes in hex before assuming text: 89 50 4E 47 is a PNG, 50 4B 03 04 is a ZIP, 1F 8B is gzip, 25 50 44 46 is a PDF. If you see one of those, you want a file, not a string.

Frequently asked questions

Why does my decoded text contain question marks?

The bytes were interpreted as ASCII or Latin-1 when they are UTF-8. Decode as UTF-8.

Is Base64 output itself ASCII?

Yes. The 64-character alphabet plus "=" is all within ASCII, which is the whole point of the encoding.

How do I know if the decoded bytes are text?

Look at the first bytes in hex. Known file signatures mean binary; printable ASCII ranges suggest text.

Ready to try it?

Open the free browser-based Base64 encode/decode and apply what you just read — no sign-up, runs locally.

Open the Base64 encode/decode tool