Input

Mode:

Output

What Is Text to Base64 Encoding?

Base64 is a way to represent binary data, or any text, using only 64 printable ASCII characters. It's not encryption; it's encoding. You'll bump into it constantly when working with HTTP Authorization headers, JWTs, email attachments via MIME, and anywhere a binary-safe transport is needed but only ASCII text is allowed. This tool handles the encoding in your browser: paste text in, get Base64 out. No server involved.

Switch between Encode (text → Base64) and Decode (Base64 → text) using the mode buttons. The encoder uses a UTF-8-safe method so characters like emojis, Chinese, Arabic, or any non-Latin text encode correctly, unlike the browser's raw btoa() which only handles Latin-1.

How to Use This Tool

1

Choose Mode

Pick a direction with the Encode / Decode pair in the input header. Switching re-runs the conversion on whatever is already in the box, so flipping to Decode with plain text still there gives an error until you paste real Base64.

2

Paste Input

Type or paste on the left. Sample follows the mode: Encode loads Order ORD-20481 ships Friday and Decode loads T3JkZXIgT1JELTIwNDgxIHNoaXBzIEZyaWRheQ==. Upload reads a .txt file as UTF-8 text.

3

Copy or Download Result

Output follows your typing with a short delay of roughly a third of a second. Copy takes the converted text, and Download saves it as encoded.txt or decoded.txt depending on the mode.

Example

Encoding a short order note to Base64. Every 3 bytes of text become 4 Base64 characters, and the == at the end pads the last group:

Text Input

Input

Base64 Output

Output

Frequently Asked Questions

Is Base64 encoding the same as encryption?

No. Base64 is encoding, not encryption. Anyone who sees a Base64 string can decode it: there's no secret key involved. It's designed for safe text transport, not confidentiality. If you need to protect data, use proper encryption like AES via the Web Crypto API.

Why does Base64 output end with = or ==?

Base64 encodes 3 bytes at a time into 4 characters. When the input's byte count doesn't divide evenly by 3, padding characters (=) are added to make the output length a multiple of 4. One = means one byte of padding was added; two means two bytes. See RFC 4648 §4 for the full spec.

Can I encode Unicode, emoji, or non-Latin text?

Yes. This tool uses a UTF-8-safe encoding path: the input is first encoded with encodeURIComponent(), then unescaped, then passed to btoa(). This correctly handles Chinese, Arabic, Japanese, emoji, and any other Unicode text. The browser's native btoa() alone would throw an error on non-Latin-1 characters, which is why the page encodes to UTF-8 bytes first.

Is my text private when I use this tool?

Nothing is uploaded. The conversion is the browser's own btoa() and atob() running on this page, and Download builds its file locally from the output pane. Just remember the output itself protects nothing: anyone holding the Base64 can read your text.

What is the difference between standard Base64 and Base64url?

Standard Base64 (defined in RFC 4648) uses + for value 62 and / for value 63, plus = padding. Base64url (used in JWTs and URLs) replaces those with - and _, and omits padding. Decode mode here reads Base64url as it is, missing padding included. If you need Base64url output, use our Base64 URL Encoder instead.

Why does Base64 output look longer than the input?

By design: each group of 3 input bytes is written as 4 Base64 characters, so the output is roughly 33% larger than the input. This is the overhead you pay for a binary-safe, ASCII-only representation.

Related Tools

The 64-character alphabet and the padding rules come from RFC 4648, sections 4 and 5. MDN's Base64 glossary entry covers the browser side, and the btoa() reference explains why plain btoa() throws outside Latin-1, which is why this page runs your text through encodeURIComponent first.