Normalization before decoding

Base64 in the wild is rarely clean. JWT segments use - and _ without padding; email bodies contain line breaks; copy buttons add whitespace. The decoder normalizes all of these before decoding: it strips whitespace, maps the URL-safe alphabet back to standard characters, and restores padding to a multiple of four.

What if the output looks like garbage?

  • The decoded bytes are not UTF-8 text — they may be an image or a binary format.
  • The input was encoded from a non-UTF-8 source, such as GBK or Latin-1.
  • The string is double-encoded: a Base64 value that itself contains Base64.
  • The input is truncated, losing the last group and producing incomplete bytes.

If decoding a file produces replacement characters, try interpreting the bytes in the original encoding rather than assuming UTF-8.

Decoding safely

Base64 is often used to hide malicious payloads or credentials. Do not paste secrets into untrusted tools; this decoder runs locally, but the content still enters your clipboard and browser history. Treat unknown Base64 as untrusted input.