Base64 strings turn up constantly in developer work — inside JWTs, in HTTP Authorization headers, in data URIs, in API payloads and config files. Decoding one tells you what it actually contains.
How to use the Base64 Decoder
- Paste the Base64 string
- Click Decode
- If the result is unreadable, the original data was binary rather than text
- Copy the decoded output
Recognising Base64 in the wild
Base64 looks like a long run of mixed-case letters and digits, often ending in one or two = characters. Its length is always a multiple of 4 when padded.
Hyphens and underscores instead of plus and slash mean the URL-safe variant — most commonly a JWT, which is three Base64url segments separated by dots. For those, use the JWT Decoder, which splits the segments and formats the JSON for you.
Why decoding sometimes produces garbage
Base64 decodes to bytes. Those bytes are only readable text if the original input was text. Decode an encoded PNG and you get the file's raw bytes rendered as meaningless characters — that is correct behaviour, not a failure.
Truncated input also produces garbage or an error: because Base64 works in 4-character groups, losing characters from the middle corrupts everything after that point. If a decode looks wrong, check you copied the whole string.
Identifying what you have decoded
Decoded output is bytes, and bytes only look like text if they were text. The first few characters usually identify the content.
{or[— JSON. Run it through a formatter next.<?xmlor<svg— XML or an SVG image.%PDF-— a PDF document.\x89PNG— a PNG. You will seePNGafter one unreadable byte.\xFF\xD8\xFF— a JPEG, which renders as garbage in a text box.PK— a ZIP archive, and therefore possibly a .docx, .xlsx or .jar, which are all ZIPs.-----BEGIN— a PEM-encoded key or certificate.
If the output begins with one of the binary signatures, the data is a file rather than text and needs saving to disk rather than reading. If it begins with something that looks like text but is not quite, you may be looking at a second layer of encoding — Base64 inside Base64 is common in obfuscated payloads and in some token formats.
Common decoding failures and what causes them
Base64 decoding fails in a small number of predictable ways.
Invalid character errors usually mean the string is URL-safe Base64 being read as standard. The URL-safe alphabet uses - and _ where standard uses + and /. Swapping them back fixes it.
Length errors mean the padding is missing. Standard Base64 pads to a multiple of four with =, but URL-safe variants and JWTs routinely strip the padding because = needs escaping in a URL. Adding one or two = characters until the length divides by four is the fix.
Whitespace breaks strict decoders. Base64 from an email header or a PEM file is wrapped at 64 or 76 characters, and those newlines must be removed first.
Mangled plus signs are a subtle one. If Base64 travelled through a URL query string without being encoded, every + arrives as a space, because that is what + means in a query. Replacing spaces with + before decoding recovers it.
Why Base64 keeps appearing in things you are debugging
Once you recognise it, Base64 turns up constantly, and knowing which layer it belongs to speeds up diagnosis.
JWTs are three Base64url segments separated by dots. Decoding the middle one shows the claims — though the JWT decoder handles the padding and segmentation for you.
Basic authentication headers carry Basic followed by Base64 of username:password. This is encoding for transport, not security, which is why Basic auth over plain HTTP exposes credentials outright.
Data URIs in HTML and CSS inline a file after ;base64,.
Email attachments and headers. MIME parts are Base64 encoded, and non-ASCII subject lines use an encoded-word form beginning =?UTF-8?B?.
Certificates and keys in PEM format are Base64 between BEGIN and END lines.
Kubernetes secrets store values Base64 encoded in the manifest — which, again, is encoding rather than encryption, and a frequent misunderstanding.
Obfuscated payloads. Malicious scripts commonly Base64 a stage to evade naive scanning, sometimes in several layers. Decoding is the first step in understanding one.
Frequently asked questions
Why does my decoded output look like nonsense?
The encoded data was binary — an image, a compressed file, or a cryptographic signature. Those decode to bytes with no text representation. This is expected.
Can I decode a JWT with this?
You can decode each segment individually after splitting on the dots, but the JWT Decoder does it in one step and formats the resulting JSON.
Is the decoding done on a server?
No, entirely in your browser. Important here, because Base64 strings you need to inspect often contain tokens or credentials.
What if decoding fails with an error?
The input is not valid Base64. Common causes are a truncated copy, stray whitespace or line breaks in the middle, or characters from a different encoding scheme such as hex.