How to decode Base64 to UTF-8
- Paste the Base64 into Input · Base64. Charset is preset to UTF-8.
- Read the result in Output · text. The status line shows the byte count and the detected content type.
- If the status line says “Some bytes are not valid UTF-8”, the text is in another charset. Try Auto-detect, Windows-1252 or UTF-16LE.
- Copy output copies the text; Download saves the decoded bytes unchanged.
To encode in the other direction, use UTF-8 to Base64.
Examples
| Base64 | Decoded as UTF-8 | What it shows |
|---|---|---|
8J+YgA== | 😀 | One emoji, 4 bytes |
4oKs | € | 3 bytes, no padding needed |
bmHDr3ZlIGNhZsOp | naïve café | Accented letters, 2 bytes each |
77u/SGk= | Hi | 5 bytes: a byte order mark, then Hi |
Y2Fm6Q== | caf� | E9 is Latin-1 é, invalid in UTF-8 |
8J+Y | � | An emoji cut after 3 of its 4 bytes |
Y2Fmw4PCqQ== | café | Valid UTF-8 of text that was already garbled |
The last three rows are the problems covered below: a wrong charset, a cut-off string and text that was garbled before encoding.
Invalid UTF-8 and the replacement character
UTF-8 has strict rules: a byte above 7F must be part of a 2-, 3- or 4-byte sequence with a fixed pattern. Bytes that break the pattern cannot be read as UTF-8. The decoder replaces each broken sequence with U+FFFD (�) and adds the note “Some bytes are not valid UTF-8. Try another charset.”. Nothing is dropped silently, so each � marks the exact spot of a problem.
Two causes cover nearly every case:
- A different charset.
Y2Fm6Q==holds63 61 66 E9, which iscaféin ISO-8859-1 and Windows-1252. Switch Charset and the text appears. The Base64 decoder page lists the common symptoms per charset. - A truncated string. If Base64 was cut, for example by a column limit in a database or a log line, the last character may lose some of its bytes.
8J+YgA==is a complete emoji;8J+Yis the same emoji missing its last byte and decodes to a single�. Look for the full value at the source.
Double-encoded text (é and ’)
When output shows é for é, ü for ü or ’ for a curly apostrophe, the decoder is not at fault. Somewhere earlier, UTF-8 bytes were read as Windows-1252 and saved again as UTF-8, turning each special character into two or three wrong ones. The Base64 faithfully holds that damaged text: Y2Fmw4PCqQ== is valid UTF-8 for the seven-byte string café.
You can often repair such a string in code by reversing the mistake: encode the text as Windows-1252 and decode the bytes as UTF-8. The real fix is in the system that wrote it.
Byte order marks
Some editors, especially on Windows, start UTF-8 files with the bytes EF BB BF, a byte order mark. In Base64 the file then starts with 77u/. The decoder recognizes the mark and leaves it out of the text, while Download keeps the bytes exactly as they were. In code you may need to remove it yourself:
import base64
raw = base64.b64decode("77u/SGk=")
raw.decode("utf-8") # '\ufeffHi'
raw.decode("utf-8-sig") # 'Hi'
base64.b64decode("Y2Fm6Q==").decode("utf-8", errors="replace") # 'caf�'
Without errors="replace", Python raises UnicodeDecodeError on invalid bytes. In JavaScript, new TextDecoder("utf-8", { fatal: true }) throws a TypeError instead of inserting �, and the default decoder strips the BOM like this tool does. More in Base64 in Python and Base64 in JavaScript.
FAQ
How do I decode Base64 to a UTF-8 string?
Decode the Base64 to bytes, then interpret the bytes as UTF-8. Above, that happens in one step. In Python it is base64.b64decode(s).decode("utf-8"); in a browser, new TextDecoder().decode(bytes).
What does the � character in the output mean?
It is U+FFFD, the replacement character. The decoder inserts it wherever the bytes do not form valid UTF-8, which usually means the text was encoded in another charset or the Base64 was cut off.
Why does my decoded text start with an invisible character?
The source probably had a UTF-8 byte order mark (Base64 starting with 77u/). This tool drops it, but Python’s plain .decode("utf-8") keeps it as \ufeff; use "utf-8-sig" to remove it.
Is UTF-8 the right choice for my Base64?
Most likely. JSON, the web, Linux and modern APIs all use UTF-8. Data from older Windows programs or from .NET and PowerShell strings may be Windows-125x or UTF-16 instead.