Base64 to Text Decoder

Decode Base64 to text. Free Base64 decoder.

Going the other way? Text to Base64

Rate this tool

How useful was this tool?

Base64 to Text

Paste Base64 into Base64, or load the Example, and the decoded result appears under Text. You don’t need to clean the input first. The decoder reads:

  • the standard or the URL-safe alphabet (+/ or -_), with or without = padding
  • line breaks and spaces, as in email attachments and certificates
  • a whole data: URL, whose type it recognises
  • stray characters, which are skipped and listed in a warning

A card describes what the input looked like, and the stats show the Base64 characters, the bytes, the characters of text and how the bytes were read. Images get a preview, and every result has a hex dump of the first 64 bytes and a download of the decoded bytes.

Read the bytes as is set to whatever they look like (detected) by default. You can also choose UTF-8, UTF-16 little-endian, UTF-16 big-endian or Windows-1252 / Latin-1 by hand. Copy takes the text, and Clear starts over.

Everything is decoded in your browser; nothing you paste is sent anywhere.

Example

Q2Fmw6kg4piV

decodes to Café ☕. That’s 12 Base64 characters, 9 bytes and 6 characters of text, read as UTF-8. é takes two of the bytes and ☕ takes three. This is the Text to Base64 example in reverse.

How the bytes become text

Base64 only stores bytes. To show them as text, the decoder has to know which encoding turned the text into bytes in the first place. With detection on, it checks:

  1. A byte-order mark at the start says UTF-16, and which way round.
  2. A pattern of zero bytes in every other position says UTF-16 without a mark. Plain letters in UTF-16 are a letter byte and a zero byte.
  3. Otherwise UTF-8, what the web, email and nearly every API use.

Any byte that isn’t valid UTF-8 is read as Windows-1252, the old web encoding, and named in a note. So Q2Fm6Q==, which is “Café” written one byte per character, still decodes to “Café” instead of “Caf�”.

Seeing mojibake happen

Choose the wrong encoding by hand and you can watch the familiar garbage appear. The same example read as Windows-1252 gives:

Café ☕

Each UTF-8 byte is shown as a separate character: é’s two bytes become “é”, and ☕’s three become “☕”. If you’ve ever seen “é” on a website or in an email, this is why. The text was UTF-8 and something read it as Windows-1252. Switch the setting to UTF-8 and it’s right again.

Files and binary data

Base64 often carries files, not text. The decoder recognises common files by their first bytes: PNG, JPEG, GIF, WebP, SVG, PDF, ZIP, gzip and MP3. It calls random binary data “binary” instead of showing it as garbage. Images get a preview, and the download saves the bytes with a sensible file name.

You can often tell what a Base64 string holds just by how it starts:

Starts with It’s
iVBORw0KGgo a PNG image
/9j/ a JPEG image
R0lGOD a GIF image
UklGR a RIFF file, such as WebP
PHN2Zy or PD94bWw SVG or other XML (<svg or <?xml)
JVBERi0 a PDF (%PDF-)
UEsDB a ZIP file (also .docx, .xlsx, .jar)
H4sI gzip-compressed data
SUQz an MP3 with tags (ID3)
eyJ JSON ({"), as in tokens

The hex dump of the first 64 bytes shows the raw bytes for anything the decoder doesn’t recognise. That’s usually enough to look up the file type.

Base64 inside Base64

Sometimes data has been encoded twice. YUdWc2JHOD0= decodes to aGVsbG8=, which is still Base64. When the result looks like Base64 again, the tool offers a second pass in one click, which gives hello. Double encoding is common in configuration files and secrets that went through more than one system.

Reading a JSON Web Token

A JWT is three URL-safe Base64 parts joined by dots: a header, a payload and a signature. Paste the middle part, for example:

eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkphbmUifQ

and you get the payload: {"sub":"1234567890","name":"Jane"}. The missing padding and URL-safe characters are no problem.

Two things to keep in mind. Decoding a token isn’t verifying it: anyone can read a JWT, and only the signature, checked with the right key, proves it’s genuine. And because anyone can read one, a token should never carry passwords or other secrets.

FAQ

Is Base64 encryption?

No. It makes data safe to send through systems that only handle text. Anyone can decode it, as this page shows, so it hides nothing.

Why does the string end with = or ==?

That’s padding. Base64 works in blocks of four characters, each holding three bytes. = marks a last block that held two bytes, and == one that held one. The decoder works fine with or without it.

Can I get an image or file back?

Yes. Paste the Base64 or the whole data: URL. The file type is recognised, images are previewed, and the download gives you the file. For images there are also Base64 to PNG and Base64 to JPG.

Why does atob() give me garbled text?

JavaScript’s atob() returns one character per byte, the Windows-1252 way, so any UTF-8 text with accents or emoji comes out as mojibake. To decode UTF-8 properly in a browser, use new TextDecoder().decode(Uint8Array.from(atob(b64), c => c.charCodeAt(0))). In Python it’s base64.b64decode(b64).decode('utf-8'), and in PHP base64_decode($b64).

What if my Base64 has spaces, line breaks or odd characters?

Spaces and line breaks are ignored. Other characters that don’t belong, such as quote marks or > signs from a forwarded email, are skipped and listed in a warning. Check the list: if many characters were skipped, the input may not be Base64 at all.

Note: All processing is done client-side. We do not store or see your data.

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us