How to Encode Base64
Convert text to UTF-8 bytes, then to Base64. The result is longer ASCII, not a secret. Unicode and emoji need the UTF-8 step or they will be corrupted.
By Andreas RosenbergUpdated
Steps
- Start with the exact text you want represented as bytes.
- Encode those characters as UTF-8. Skipping this and using a Latin-1-only function breaks å, ä, ö and emoji.
- Apply the Base64 alphabet to those bytes.
- Copy the ASCII result. Remember: anyone can decode it.
On the MultiConvers Base64 encoder, paste the text and choose Encode. The UTF-8 step is already done.
A worked example
“Hello” is five UTF-8 bytes: 72, 101, 108, 108, 111 (hex 48 65 6C 6C 6F). Base64 takes those bytes three at a time. The first three become the characters SGVs. The last two bytes are not a full group of three, so the encoder pads with one =. The whole string is SGVsbG8=.
“Göteborg” is longer in UTF-8 than in letters, because ö is two bytes. That is why its Base64, R8O2dGVib3Jn, is not a one-byte-per letter encoding. Skip the UTF-8 step and those characters corrupt.
The limit
This page encodes text. A file’s raw bytes use the same alphabet only after something else has read those bytes; pasting a filename does not encode the file. The result is reversible ASCII, not a secret. Anyone can decode it without a key. Stripping the trailing = can make a strict decoder reject the string, so keep the padding.
Examples
| Text | Base64 |
|---|---|
Hello | SGVsbG8= |
Göteborg | R8O2dGVib3Jn |
Base64 is still not encryption — see what Base64 is. If you need a value safe inside a query string, you may also need percent-encoding.
FAQ
- Why is the Base64 longer than my text?
Every three bytes become four characters. UTF-8 also uses more than one byte for many non-ASCII letters.
- Can I encode a file, not text?
This page encodes text as UTF-8. Binary files use the same Base64 alphabet after you read their bytes; that is a different input path.
Related guides
What Is Base64?
Base64 is a way to write binary data using 64 ASCII characters. It is encoding, not encryption. Anyone who sees the string can decode it.
How to Decode Base64
Decoding reverses Base64 back to bytes, then to text with UTF-8. Invalid characters should fail loudly. Success does not mean the original message was secret.
Related tools
See all guides.