ToolsTechBox

Base64 Encoder / Decoder

Encode or decode Base64 text instantly. 100% offline.

Text Encode / Decode

Input

Output

File to Base64

🔐 How the Base64 Encoder/Decoder Works

Base64 is a binary-to-text encoding scheme that represents binary data using only 64 printable ASCII characters. It was designed to safely transmit binary data through channels that only handle text (like email, JSON, HTML).

Encode: btoa(unescape(encodeURIComponent(text))) // UTF-8 safe Decode: decodeURIComponent(escape(atob(base64String)))
1
Every 3 bytes (24 bits) of input are split into 4 groups of 6 bits. Each 6-bit value maps to one of 64 characters: A–Z, a–z, 0–9, +, /.
2
If the input length isn't divisible by 3, padding characters (= or ==) are appended so the output length is always a multiple of 4.
3
The tool uses encodeURIComponent → unescape → btoa to correctly handle Unicode characters beyond ASCII before passing to the native browser Base64 engine.
Example: Encode "Hi"
H = 01001000 | i = 01101001 → combined 16 bits + 8 bits padding
Split into 4×6-bit groups → 'H', 'i', padding → SGk=

Uses the browser's native btoa() / atob() APIs — no external libraries required.

Read: What Is Base64 Encoding?

Explore More Tools