Skip to content
DeepBase64

Why does my decoded base64 look like garbage?

You decoded something and got a run of meaningless characters, question marks or replacement symbols. There are two quite different reasons for that, and they call for opposite responses, so it is worth knowing which one you are looking at.

The first is that your input was never base64 to begin with. The base64 alphabet is letters, digits, plus and slash — which means a great deal of ordinary text qualifies as valid base64 by shape alone. A hex digest, a UUID with the hyphens removed, a git commit hash, and plain English words like "test" or "Password" all pass a character check. Decoding them is a legal operation that produces bytes which were never text, so the result is noise. The decoder did not fail; it answered a question you did not mean to ask.

The second is that the input really was base64 and the payload simply is not text. Base64 exists to carry arbitrary bytes through channels that only accept characters, and those bytes are frequently an image, a compressed archive, a certificate, a protobuf message or an encrypted blob. Decoding worked perfectly. What came out was never meant to be read as letters.

You can usually tell them apart from the first few bytes of the result. A PNG starts with the letters PNG after one non-printable byte; a gzip stream starts with two fixed bytes; a PDF begins with a visible marker; a certificate in DER form starts with a structure byte rather than anything readable. If the output begins with a recognisable signature, you have real data in a format, not a failed decode.

The other check is reversibility. Re-encode the result and compare it with what you started from. Genuine base64 round-trips exactly. A value that was only base64-shaped usually does not, because its length or padding was never produced by an encoder.

This matters most for tools that decode repeatedly. One that peels while the input still looks decodable will eventually destroy a perfectly good value by decoding it one time too many, and report a layer count that includes a layer that never existed. Stopping at the right point, and saying why it stopped, is the part that is actually difficult.

Open the decoder