Convert text to Base64 and back
Base64 is an encoding scheme that converts binary data into ASCII text. It is commonly used in email (MIME), embedding images in HTML/CSS (data URIs), and transmitting data in URLs. Each Base64 character represents 6 bits of data, making encoded output approximately 33% larger than the original.
Encode text to Base64 or decode Base64 strings back to readable text instantly. Base64 encoding is essential for embedding data in HTML, sending binary data over text-based protocols like email, and working with APIs that require Base64-encoded authentication credentials.
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, and /). It was designed to carry data stored in binary formats across channels that only reliably support text content. The name comes from the fact that it uses a base of 64 characters.
Base64 encoding is commonly used in several scenarios: embedding images directly in HTML or CSS using data URIs, encoding email attachments via MIME, transmitting binary data in JSON or XML, HTTP Basic Authentication headers, and storing complex data in cookies or URLs. It increases data size by approximately 33%, so it is best used for small payloads.
Base64 encoding takes every three bytes (24 bits) of input and splits them into four groups of 6 bits each. Each 6-bit group maps to one of 64 characters. If the input length is not divisible by 3, padding characters (=) are added. This is why Base64 strings often end with one or two equals signs.
It is crucial to understand that Base64 is NOT encryption. It is an encoding scheme that anyone can decode. Never use Base64 to protect sensitive information like passwords or API keys. For security, use proper encryption algorithms like AES-256 or hashing algorithms like SHA-256.
No. Base64 is an encoding scheme, not encryption. Anyone can decode Base64 strings. It should never be used to protect sensitive data. Use proper encryption (AES, RSA) for security.
Base64 converts every 3 bytes into 4 characters, increasing size by approximately 33%. This is because it represents 8-bit data using only 6 bits per character, requiring more characters to store the same information.
The standard Base64 alphabet consists of A-Z (26), a-z (26), 0-9 (10), plus (+) and forward slash (/), totaling 64 characters. The equals sign (=) is used for padding. URL-safe Base64 replaces + with - and / with _.
This tool encodes text to Base64. For encoding images, you would need to read the image as binary data first. Many programming languages provide built-in functions for this, such as Python's base64 module or JavaScript's btoa() function.
There is no theoretical maximum for Base64 encoding, but practical limits depend on the application. Data URIs in HTML have browser-specific limits (typically 2-4 MB). Email attachments encoded in Base64 are usually limited by the email server's maximum message size.