Base64 Encoder/Decoder
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into a printable ASCII string format.
It represents binary data using a set of 64 characters: A–Z, a–z, 0–9,
+, and /, with = used as padding. The name "Base64" comes from the
fact that the encoding uses 64 distinct characters to represent data.
Base64 encoding was originally defined in RFC 4648 and is widely used across the internet for transmitting data over channels that only support text. It increases the size of the original data by approximately 33%, but ensures that the data can safely pass through text-based protocols without corruption.
How Does Base64 Encoding Work?
The Base64 encoding process follows these steps:
- Convert to binary: Each byte of the input is converted to its 8-bit binary representation.
- Group into 6-bit chunks: The binary stream is divided into groups of 6 bits.
- Map to Base64 characters: Each 6-bit value (0–63) is mapped to a character in the Base64 alphabet.
- Add padding: If the input length is not a multiple of 3 bytes,
=padding characters are appended.
For example, the text Hi (2 bytes) becomes SGk= in Base64. The text
Hello (5 bytes) becomes SGVsbG8=.
Common Use Cases for Base64
- Email Attachments (MIME): Email protocols like SMTP are text-based and cannot handle raw binary data. Base64 encoding allows images, documents, and other binary files to be embedded in email messages.
- Embedding Images in HTML/CSS: Data URIs use Base64 to embed small images directly in HTML or CSS files, reducing HTTP requests. For example:
data:image/png;base64,iVBORw0KGgo... - API Data Transfer: REST APIs often use Base64 to encode binary data (like images or certificates) within JSON payloads, since JSON does not natively support binary data.
- Authentication Tokens: HTTP Basic Authentication encodes credentials as Base64 strings in the
Authorizationheader. - Storing Binary in Text Fields: When databases or configuration files only support text, Base64 lets you safely store binary data like encryption keys or certificates.
- URL-Safe Encoding: Base64url (a variant) replaces
+and/with-and_, making it safe for URLs and filenames.
Base64 Encoding vs. Encryption
A common misconception is that Base64 provides security. Base64 is not encryption — it is simply an encoding scheme. Anyone can decode a Base64 string back to its original form without any key. If you need to protect sensitive data, use proper encryption (such as AES or RSA) before encoding.
How to Use This Tool
- Paste or type your text into the Input Text field.
- Click Encode to convert your text to Base64, or Decode to convert Base64 back to text.
- Copy the result using the Copy button, or use Copy Data URI to get a ready-to-use data URI.
All processing happens securely — your data is not stored or logged. For image-specific Base64 conversion, try our Base64 Image Converter.
Why Use This Tool?
- Encode and decode Base64 strings instantly in your browser.
- Handles Unicode text properly using TextEncoder/TextDecoder.
- Copy data URIs for embedding directly in HTML or CSS.
- 100% client-side processing — your data never leaves your device.
Frequently Asked Questions
%XX hex values.
Base64 converts binary data to a text representation using a 64-character alphabet. They serve different
purposes. Try our URL Encoder/Decoder for URL encoding.