Text to Base64 Encoder
Encode any text to Base64, with full UTF-8 support.
Your data is never sent to any server.
The text to Base64 encoder turns any text into a Base64 string ready to paste into a header, a config file or an API request. It handles accents and emoji, because it encodes the text as UTF-8 before converting it to Base64.
What happens to each letter
Base64 takes the bytes 3 at a time, splits them into 4 chunks of 6 bits and replaces each chunk with one of its 64 characters:
| Text | Bytes | Base64 |
|---|---|---|
Hel | 3 | SGVs |
Hello | 5 | SGVsbG8= |
Hello world | 11 | SGVsbG8gd29ybGQ= |
With 5 bytes, the last block is one byte short, which is why Hello ends in a
single equals sign.
Where it shows up every day
- HTTP basic authentication: the
Authorization: Basicheader carries theuser:passpair in Base64, which becomesdXNlcjpwYXNz. Anyone who intercepts the header can read it, which is why basic auth is only safe over HTTPS. - Kubernetes Secrets: the values in a Secret’s
datafield are written in Base64. - Environment variables: a certificate or a JSON blob with line breaks and quotes travels without trouble once it is encoded.
To encode an image or any other file instead of text, use the file to Base64 option in the switch.
How to use Text to Base64
- 1
Type or paste the text
The Base64 string appears as you type, without pressing any button.
- 2
Copy the result
Press the copy button to take the string, including its trailing equals signs if it has any.
- 3
Switch direction if you need to
The switch above takes you to decoding Base64 or to converting files.
Frequently asked questions
What is Base64?
A way of writing any data using only 64 safe characters: upper and lowercase letters, digits, + and /. It is used to carry data through places that only accept text, such as an HTTP header, a JSON document or an email.
Does Base64 encrypt the text?
No. It is an encoding, not encryption: anyone can reverse it without a key. Do not use it to hide passwords or sensitive data.
Why does the string end in = or ==?
That is padding. Base64 works in blocks of 3 bytes, and when the last block has only 1 or 2, it is completed with two or one equals signs so the length is a multiple of 4.
Why is the result longer than the text?
Because every 3 bytes become 4 characters, so Base64 takes a third more space than the original. A 300-byte text gives a 400-character string.
Does it work with accents and emoji?
Yes. The text is converted to UTF-8 first, which is what the programs that decode it expect, so accented letters and emoji come back intact.