Base64 Decode

Paste a Base64 string to decode it back to readable text, or save binary data as a file. Standard, URL-safe, unpadded and data: URI input all work.

0 bytes
0 chars

Everything runs in your browser. Your text and files are never uploaded.

How to decode Base64

  1. Paste the Base64 string into the left box. A full data:...;base64, URI works too; the prefix is removed for you.
  2. Read the result. Valid UTF-8 text appears on the right as you type. Line breaks and spaces in the input are ignored, so wrapped MIME output decodes fine.
  3. Save binary data. If the bytes are not text, the status line says so and names the file type when it can recognise it (PNG, JPEG, GIF, WebP, PDF, ZIP). Click Download to save it.

To go the other direction, use the Base64 encoder.

Example

The string SGVsbG8sIEJhc2U2NCEg5L2g5aW9IPCfkYs= decodes to Hello, Base64! 你好 👋. It is loaded in the tool above so you can try it. Because the decoder reads the bytes as UTF-8, the Chinese characters and the emoji come back exactly as they went in.

Which kind of Base64 do you have?

What you see What it is Works here
A–Z a–z 0–9 + /, ends in = Standard Base64 (RFC 4648) Yes
Contains - or _, no = Base64URL, used in JWTs and URLs Yes
Starts with data:image/png;base64, A data URI Yes, prefix removed
Lines of 76 characters MIME-wrapped Base64 from email Yes, line breaks ignored

If a string has the right characters but still fails, count its length. After removing padding, a valid Base64 string never leaves a remainder of 1 when divided by 4. A remainder of 1 almost always means a character was lost during copy and paste.

Base64 to text, or binary?

Most people who decode Base64 want text back, which is why this page doubles as a Base64 to text converter: paste the string and readable text appears on the right.

Decoding always returns bytes. Whether those bytes are text depends on what was encoded. This page tries to read them as UTF-8 and shows the text if that works. If it does not, the data is probably an image, an archive, or text in another encoding. Images can be previewed and saved on the Base64 to image page.

Is decoding safe?

Decoding happens in your browser with JavaScript and nothing is uploaded, so you can safely decode tokens, configuration values or internal data. Keep in mind that this also means Base64 protects nothing: anyone who has the string can read it.

Line breaks, MIME wrapping and character sets

Base64 that comes out of email or PEM files is usually wrapped at 76 characters per line (some older tools use 64). The line breaks are not part of the data, so the decoder strips every space, tab and newline before decoding. You can paste a whole MIME body part or a certificate block between its -----BEGIN and -----END lines and it will decode the same as a single long line.

The harder question is what the decoded bytes mean. Base64 does not record a character set; it only carries bytes. This page reads them as UTF-8, which is what almost every modern system uses. If you get an error saying the result is binary, or the text looks wrong, the original was probably written in another encoding:

An email header like =?UTF-8?B?5L2g5aW9?= tells you both parts at once: the charset is UTF-8, B means Base64, and the part between the question marks is the data to paste here.

Frequently asked questions

How do I decode a Base64 string?

Paste the string into the left box. If the bytes are valid UTF-8 text, the text appears on the right right away. If they are binary, the page says what kind of file it looks like and Download saves it.

Why do I get an invalid Base64 error?

Either the input has characters outside the Base64 alphabet, or its length is impossible for Base64, usually because the string was cut off when copied. Spaces and line breaks are ignored, so check that the whole string was copied.

Can I decode URL-safe Base64 or a JWT segment?

Yes. The decoder treats - and _ as + and /, and adds any missing = padding itself. Paste one dot-separated part of a JWT at a time.

How do I decode Base64 to an image or file?

Paste the Base64 or the full data: URI. PNG, JPEG, GIF and WebP images are previewed under the tool, and Download saves the file with the right extension. See the Base64 to image guide for details.