How to convert Base64 to text
- Paste the Base64 string into the Input · Base64 box. Spaces, line breaks and surrounding quotes are fine.
- Read the text in Output · text. The status line under the tool says whether the input was valid Base64, how many bytes it held and what the content looks like.
- If the output shows
�or odd letters, change Charset. Auto-detect checks for a byte order mark, UTF-8 and UTF-16. - Copy the text with Copy output, or save it with Download.
The opposite direction is Text to Base64.
How to tell if a string is Base64
A Base64 string uses only 64 characters plus = for padding. Standard Base64 has + and /; the URL-safe variant uses - and _ instead. Padded strings have a length divisible by 4, and the = signs can only be at the end.
Those rules are necessary but not sufficient. Plenty of ordinary words pass them: Test is valid Base64 and decodes to the three bytes 4D EB 2D, which mean nothing. The practical check is to decode the string and see if something sensible comes out. When you need more than a yes or no, the Base64 validator shows which character, length or padding rule a string breaks and scores how likely it is to be Base64 at all.
Examples
| Base64 string | Text | Note |
|---|---|---|
VGhhbmsgeW91IQ== | Thank you! | Plain ASCII |
SGVsbG8sIFfDtnJsZA== | Hello, Wörld | ö is two bytes in UTF-8 |
5L2g5aW9 | 你好 | Six bytes, three per character |
0J/RgNC40LLQtdGC | Привет | Cyrillic in UTF-8 |
QmFzZTY0IGlzIG5vdCBlbmNyeXB0aW9uLg== | Base64 is not encryption. | Anyone can read it |
dXNlcm5hbWU6c2VjcmV0 | username:secret | The format of an HTTP Basic auth header |
As the last row shows, anyone who sees an Authorization: Basic header can read the password in it. The Basic Auth decoder splits such a header into user and password, and encoding vs encryption explains why HTTPS is what actually keeps it private.
From bytes to a string
Decoding Base64 gives you bytes. Getting a string out of them is a second step that needs a charset, and that step is where most “wrong text” problems come from. Most languages make the two steps explicit:
import base64
raw = base64.b64decode("SGVsbG8sIFfDtnJsZA==")
raw # b'Hello, W\xc3\xb6rld'
raw.decode("utf-8") # 'Hello, Wörld'
raw.decode("latin-1") # 'Hello, Wörld'
In JavaScript, a TextDecoder with fatal: true throws a TypeError instead of quietly inserting �, which is useful when you would rather fail than store broken text:
const bytes = Uint8Array.from(atob("Y2Fm6Q=="), c => c.charCodeAt(0));
new TextDecoder("utf-8", { fatal: true }).decode(bytes);
// TypeError: the bytes are not valid UTF-8
new TextDecoder("windows-1252").decode(bytes); // "café"
More patterns are on the Python and JavaScript pages.
When the output is not readable text
- Mostly symbols with a few readable words. The string holds a file. Check Looks like in the status line, then open it in Base64 to file, which previews and saves it.
- Letters separated by gaps. The text is UTF-16. Set Charset to UTF-16LE.
- Readable text, but
éshows asé. The text was mis-decoded somewhere before it was encoded. The Base64 is fine; the source data is not. - The output is Base64 again. It was encoded twice. Copy the output, paste it as input and decode once more.
- Random-looking bytes and no detected format. The data is probably encrypted or compressed. Base64 decoding is only the first layer; for gzip or zlib data try the gzip Base64 decoder.
FAQ
What is a Base64 string?
Text made only of the characters A–Z, a–z, 0–9, + and /, often ending in = or ==. It stands for bytes, which may be text, an image or any other file, written so they survive systems that only handle plain characters.
How can I tell what a Base64 string contains before decoding it?
The first characters often reveal it: eyJ is JSON, PD94bWwg is XML, iVBORw0KGgo is a PNG and JVBERi0 is a PDF. After decoding, the status line names the detected format. See common Base64 prefixes.
How do I convert Base64 to a string in Python?
base64.b64decode(s).decode("utf-8"). The first call returns bytes; .decode() turns them into a str using the charset you name.
Why is the decoded text another Base64 string?
The value was encoded twice, which happens when two layers of a system each encode it. Paste the output back into the input and decode again.