Base64 Encoder / Decoder
Encode text or files to Base64, or decode Base64 strings. Fully client-side.
Tips
- Upload images or small files to generate data URIs for inline embedding in HTML/CSS.
- Base64 output is always about 33% larger than the input due to the encoding scheme.
- This tool handles UTF-8 and Unicode correctly, including emoji and CJK characters.
- Base64 is encoding, not encryption. Never use it to protect sensitive data.
- Press Cmd+Enter to re-encode or re-decode.
Understanding Base64 Encoding
Base64 is a binary-to-text encoding scheme that converts binary data into printable ASCII characters using a 64-character alphabet (A-Z, a-z, 0-9, +, /) plus = for padding. It is widely used for transmitting binary data over text-based protocols like email (MIME), embedding images in HTML/CSS via data URIs, and encoding authentication credentials in HTTP headers.
The encoding works by grouping input bytes into 3-byte (24-bit) chunks, then splitting each chunk into four 6-bit values, each mapping to one Base64 character. When the input is not a multiple of 3 bytes, padding (=) characters are added. This makes Base64 output roughly 33% larger than the original data.
UTF-8 support matters because many simpler Base64 tools break on non-ASCII characters. Our encoder converts text to UTF-8 bytes first, ensuring emoji, CJK characters, accented letters, and all Unicode text round-trips correctly through encode then decode.
Data URIs (data:[mime];base64,[data]) let you embed files inline in HTML and CSS, eliminating HTTP requests for small assets. This tool generates complete data URIs when you upload a file, ready to paste into your code.
Base64 is encoding, not encryption. Anyone can decode it trivially. Never use Base64 to protect sensitive data. For security, use AES, RSA, or other proper encryption algorithms.