How to decode Base64
- Paste the Base64 string into the left box. A full
data:...;base64,URI works too; the prefix is removed for you. - 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.
- 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:
- Chinese text that was encoded as GBK or GB2312 is not valid UTF-8, so it shows up as binary data. Download it and open the file as GBK in a text editor.
- Latin-1 (ISO-8859-1) or Windows-1252 text with accented letters such as é or ü also fails as UTF-8, because those letters are single bytes above 127.
- Text that shows é instead of é went the other way: UTF-8 bytes were read as Latin-1 somewhere before they were encoded. The fix is in the system that produced the string, not in the decoder.
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.