Base64 Encode and Decode
Encode or decode Base64 text in the browser.
What this Base64 encoder and decoder does
This tool converts text to Base64 and Base64 back to text. It handles UTF-8 correctly, so accented letters, non-Latin scripts and emoji survive the round trip. The conversion happens locally in your browser; nothing is uploaded.
It is handy for developers working with APIs, email, data URIs and configuration files, for support engineers reading encoded values in logs, and for students learning how encodings work.
How to use the Base64 tool
- Paste or type your input into the Text box.
- Click Encode to turn plain text into Base64.
- Or click Decode to turn a Base64 string back into readable text.
- Copy the result with the Copy button.
When decoding, spaces and line breaks in the input are ignored, so Base64 that was wrapped across several lines (as in emails or PEM files) still decodes. If the input is not valid Base64, you will see an error instead of a result.
What Base64 is
Base64 is a way to represent binary data using only 64 printable ASCII characters: A–Z, a–z, 0–9, + and /, with = used as padding. It is defined in RFC 4648. Every 3 bytes of input become 4 characters of output, so Base64 text is about one third larger than the original data.
Base64 exists so that data can travel safely through systems built for text, such as email bodies, JSON fields, HTTP headers and URLs.
Examples
- "Hello, World!" encodes to "SGVsbG8sIFdvcmxkIQ==".
- "Xin chào" (with an accented letter) encodes to "WGluIGNow6Bv", because the text is first converted to UTF-8 bytes.
- Decoding "SGVsbG8sIFdvcmxkIQ==" gives back "Hello, World!".
The = signs at the end are padding. They appear when the input length is not a multiple of 3 bytes: one = means two bytes in the last group, two == mean one byte.
Common use cases
- Building or reading HTTP Basic Authentication headers, which carry username:password encoded in Base64.
- Decoding values found in configuration files, Kubernetes Secrets or environment variables.
- Inspecting email content encoded with Base64 transfer encoding.
- Preparing small text payloads for APIs that expect Base64 fields.
- Checking the header or payload of a token (for JWTs, use the dedicated JWT Decoder, which handles Base64url).
Tips and common mistakes
- Base64 is not encryption. Anyone can decode it instantly. Never use it to hide passwords or secrets.
- Base64 vs Base64url. The URL-safe variant replaces + with - and / with _ and often drops the padding. Standard decoders may reject it; convert those characters back and add padding if needed.
- Garbled output after decoding usually means the original data was not UTF-8 text, for example an image or a file in another encoding. This tool decodes to text, so binary data will not display meaningfully.
- Images. To turn an image into a Base64 data URI, use the Image to Base64 tool instead.
- Size grows. Because Base64 adds about 33%, embedding large files as Base64 makes pages and payloads heavier.
Frequently asked questions
Is Base64 encryption?
No. It is an encoding, fully reversible without a key. Use real encryption to protect data.
Why does my Base64 string end with = or ==?
That is padding, added so the output length is a multiple of 4 characters. It tells the decoder how many bytes were in the final group.
Why is the encoded text longer than the original?
Base64 represents every 3 bytes with 4 characters, so the output is roughly 33% larger, plus any padding.
Does this tool support Unicode and emoji?
Yes. Text is converted to UTF-8 bytes before encoding and decoded back from UTF-8, so non-English characters are preserved.
Is my data uploaded?
No. Encoding and decoding run in your browser.
What does "invalid" mean when I decode?
The input contains characters outside the Base64 alphabet, has the wrong length, or decodes to bytes that are not valid text. Check for URL-safe characters (- and _) or copy errors.
Related tools
- Image to Base64 – create a Base64 data URI from an image file.
- URL Encode / Decode – percent-encode text for use in URLs.
- JWT Decoder – read Base64url-encoded token headers and payloads.
- HTML Encode / Decode – convert special characters to HTML entities.
- SHA Hash Generator – create a one-way hash instead of a reversible encoding.