Base64 Encoder / Decoder
Encode and decode Base64 strings with UTF-8 support.
This tool uses the browser's btoa()/atob() functions with UTF-8 encoding support. All encoding and decoding happens locally on your device.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into a radix-64 representation. It uses characters A-Z, a-z, 0-9, +, and / to encode data, with = for padding. Base64 is commonly used in email attachments (MIME), data URIs in HTML/CSS, JSON Web Tokens (JWT), and API authentication headers.
How Base64 Encoding Works▾
Base64 encoding converts binary data into a text representation using 64 printable ASCII characters: A-Z (26), a-z (26), 0-9 (10), + and / (2), with = used for padding. The encoding process takes every 3 bytes (24 bits) of input and splits them into 4 groups of 6 bits each. Each 6-bit value maps to one of the 64 characters.
This tool handles UTF-8 encoding correctly by first converting the input string to a UTF-8 byte sequence using TextEncoder, then applying Base64 encoding to the resulting bytes. This ensures proper handling of multi-byte characters including CJK characters, emoji, and special symbols that standard btoa() cannot process directly.
The decoding process reverses these steps: Base64 characters are converted back to bytes, then decoded as UTF-8 text using TextDecoder. The entire process runs in your browser using the Web Encoding API, with no server communication whatsoever.
Step-by-Step Usage Guide▾
1. Select "Encode" to convert text to Base64, or "Decode" to convert Base64 back to text.
2. Paste or type your content in the input area.
3. The result appears instantly in the output area.
4. Click "Copy" to copy the result to your clipboard.
5. The tool supports multi-line text and preserves whitespace formatting.
Note: The 2MB input limit ensures smooth browser performance. Base64 encoding increases data size by approximately 33%, so a 1.5MB input will produce a 2MB output.
Common Base64 Use Cases▾
Data URIs: Embedding images directly in HTML or CSS using the data:image/png;base64,... format eliminates additional HTTP requests.
JWT Tokens: JSON Web Tokens use Base64url encoding (a URL-safe variant) for the header and payload sections.
Email Attachments: MIME encoding uses Base64 to safely transmit binary attachments through text-based email protocols.
API Authentication: HTTP Basic Authentication encodes credentials in Base64 format (username:password).
Important: Base64 is NOT encryption. Anyone can decode a Base64 string. Never use it to protect sensitive information like passwords or API keys.
Related Articles
Related Tools
Frequently Asked Questions
What is Base64 encoding?▾
Base64 is a binary-to-text encoding scheme that converts binary data into ASCII characters. It's commonly used in emails, data URLs, and API authentication.
Is Base64 encryption?▾
No. Base64 is an encoding, not encryption. Anyone can decode a Base64 string. It should never be used for security purposes.
Does this tool support Unicode/UTF-8?▾
Yes. This tool properly handles UTF-8 characters including emoji, CJK characters, and other multi-byte sequences.