Base64 Encode/Decode
Encode plain text to Base64 or decode Base64 strings back to readable text. Supports full Unicode characters including emojis and international scripts.
How Base64 Encoding and Decoding Works
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 ASCII characters: A-Z, a-z, 0-9, plus (+), and slash (/), with equals (=) used for padding. This tool converts your text input into its Base64 representation or decodes an existing Base64 string back into human-readable text.
Encoding Process
Text is first converted to its UTF-8 byte representation. Each group of 3 bytes (24 bits) is split into four 6-bit values. Each 6-bit value maps to one of the 64 characters in the Base64 alphabet. If the input length is not a multiple of 3, padding characters (=) are appended to make the output length a multiple of 4.
Why Use Base64 Encoding?
Base64 encoding is used whenever you need to transmit binary data through a channel that only supports text characters. Email attachments use Base64 (via MIME) because the SMTP protocol was designed for ASCII text. Data URIs in HTML and CSS embed images directly as Base64 strings. JSON payloads that need to carry binary data encode it as Base64 since JSON has no binary type.
Authentication headers in HTTP, such as Basic Auth, encode the username and password as a Base64 string. JSON Web Tokens (JWTs) use a URL-safe variant of Base64 to encode the header and payload segments. Configuration systems and environment variables sometimes store complex data as Base64 to avoid issues with special characters.
Unicode and Multibyte Character Support
This tool properly handles Unicode characters including accented letters, CJK characters, Arabic script, and emojis. The encoding step first converts the input to its UTF-8 byte sequence before applying Base64 encoding. The decoding step reverses this process, correctly reconstructing multibyte characters from the UTF-8 bytes.
Base64 vs. URL Encoding
Base64 and URL encoding serve different purposes. URL encoding (percent-encoding) makes individual characters safe for URLs by replacing unsafe characters with %XX sequences. Base64 converts arbitrary binary data into a compact text representation. For embedding data in URLs, consider using URL-safe Base64, which replaces + with - and / with _ to avoid URL conflicts.
Size Impact of Base64
Base64 encoding increases the data size by approximately 33%. Three input bytes become four output characters. This overhead is the trade-off for being able to represent binary data as ASCII text. For large files, this size increase can be significant, so consider whether Base64 is the right approach or if a binary transfer method would be more efficient.
Privacy and Security
All encoding and decoding operations run entirely in your browser. No data is sent to any server. Remember that Base64 is an encoding scheme, not an encryption method. Anyone can decode a Base64 string, so never use it to protect sensitive information.