Base64 Decoder

Decode a Base64 string back into readable text. The decoder tolerates the things that break simpler tools. URL-safe characters, missing padding, line breaks, surrounding quotes and data URI prefixes.

Your files never leave this device

Decode from Base64 Live ยท Tolerant of messy input

How to decode Base64

  1. Paste your Base64 string into the box above.
  2. Padding, line breaks and surrounding quotes are handled automatically.
  3. The decoded text appears immediately below.
  4. If the result looks like nonsense, the string probably held binary data rather than text.
  5. Copy the decoded text, or download it as a file.

What this decoder tolerates

  • URL-safe strings using hyphen and underscore instead of plus and slash.
  • Missing padding, which is common in tokens and URL-safe output.
  • Line breaks and indentation from a wrapped or copied block.
  • Surrounding quotes, trailing commas and semicolons from source code.
  • A data URI prefix, which is stripped before decoding.
  • Full UTF-8 output, so accented characters and emoji come back correctly.

Base64 strings turn up everywhere

Once you start looking, encoded data is all over the systems you work with. An Authorization header holds Base64-encoded credentials. A JSON Web Token is three Base64URL segments separated by dots. A configuration file has a certificate wrapped in PEM markers. An API returns a file as a Base64 string rather than a binary body. A stylesheet contains a data URI for an icon.

Decoding is how you find out what any of it actually says, which is usually the fastest way to understand why something is not working.

Why decoders fail on real-world strings

Strings copied out of production are rarely clean. They arrive wrapped in quotes from a source file, split across lines by a terminal, missing their padding because the producer used the URL-safe form, or with a data:image/png;base64, prefix still attached.

A strict decoder rejects all of these. This one normalises first: it strips a data URI prefix, removes quotes and trailing punctuation, discards whitespace and line breaks, converts URL-safe characters back to standard ones, and re-adds the padding. Then it decodes. That is the difference between a tool that works on textbook input and one that works on what you actually have.

Inspecting a JSON Web Token

A JWT looks like xxxxx.yyyyy.zzzzz. The first two segments are Base64URL-encoded JSON. The header and the payload, and decoding them shows exactly what claims a token carries and when it expires. The third segment is a signature and will not decode to anything readable, because it is binary.

Decode the segments separately, splitting on the dots. Run the result through the JSON formatter to read it properly. Remember that a token's payload is not secret. Anyone holding the token can read it, which is why sensitive data should never go in one.

When the output looks like nonsense

Three causes account for nearly all of it. The string may have decoded correctly but held binary data. An image, a font, a compressed archive, in which case the bytes are simply not text. It may be double-encoded, so decoding once yields another Base64 string that needs decoding again. Or it may be encrypted, in which case decoding reveals ciphertext and there is nothing more to see without the key.

If the string was an image, the Base64 to image decoder will turn it back into a file with a preview. To encode in the other direction, use the Base64 encoder. Nothing you paste is transmitted, which matters given how often these strings contain credentials.

Decoding safely

Decoding a string is safe in itself. This page turns characters into text and does nothing with the result. What matters is what you do next. A decoded payload from an untrusted source is untrusted data: if it turns out to be HTML, do not paste it into a page without escaping it, and if it is JSON, validate it before feeding it to anything.

It is also worth remembering that a decoded token frequently contains credentials. Once decoded, that text is in your clipboard and possibly in your editor history. Treat it with the same care as the original secret rather than as inert output.

Frequently asked questions

Why does my Base64 string fail to decode?

Usually it was truncated when copied, or it is URL-safe and the tool you used did not convert hyphen and underscore back. This decoder handles both, along with missing padding.

How do I decode a JSON Web Token?

Split it on the dots and decode the first two segments separately. They are the header and payload as JSON. The third is a binary signature and will not decode to readable text.

The output is unreadable characters. What happened?

The string probably held binary data such as an image or a compressed file. It may also be double-encoded, or encrypted, in which case you are looking at ciphertext.

Is padding required?

Standard Base64 pads with equals signs to a multiple of four. URL-safe output usually omits it, so this decoder adds it back automatically.

Is decoding Base64 a security risk?

Not to you, it happens entirely in your browser. But remember that anyone else can decode a string just as easily, so Base64 protects nothing.