Base64 Encoder / Decoder
Encode text to Base64 format or decode Base64 back to plain text. Perfect for developers, data processing, and secure data transmission. Fast, accurate, and completely free to use.
What Is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It uses a set of 64 printable characters (A-Z, a-z, 0-9, +, and /) to encode binary data. The "=" character is used as padding at the end of the encoded string.
Base64 is commonly used for:
- Email Attachments: Encoding binary files for transmission via email (MIME).
- Web Development: Embedding images and other binary data directly into HTML, CSS, or JavaScript.
- Data Transmission: Safely transmitting binary data over text-based protocols like JSON or XML.
- Authentication: Encoding credentials in HTTP Basic Authentication headers.
How Does the Base64 Encoder/Decoder Work?
The encoder works by:
Step 1: Convert each character of the input text to its ASCII code.
Step 2: Group the binary data into 24-bit groups (3 bytes).
Step 3: Split each 24-bit group into four 6-bit groups.
Step 4: Map each 6-bit value to a Base64 character using the standard Base64 alphabet.
Step 5: Add padding ("=") if the input length is not a multiple of 3.
The decoder reverses this process, converting Base64 characters back to binary data and then
to readable text. This tool uses the browser's built-in btoa() and atob()
functions for encoding and decoding, which are widely supported and highly reliable.
Why Use This Base64 Encoder/Decoder?
- Fast & Reliable: Uses native browser functions for instant conversion.
- Bidirectional: Encode text to Base64 and decode Base64 back to text.
- Multiple Encodings: Supports UTF-8, ASCII, and Latin-1 character sets.
- Line Width Options: Format Base64 output with line breaks for readability.
- Free & Private: No registration, no data storage. All processing is done in your browser.
Base64 Alphabet
| Index | Char | Index | Char | Index | Char | Index | Char |
|---|---|---|---|---|---|---|---|
| 0 | A | 16 | Q | 32 | g | 48 | w |
| 1 | B | 17 | R | 33 | h | 49 | x |
| 2 | C | 18 | S | 34 | i | 50 | y |
| 3 | D | 19 | T | 35 | j | 51 | z |
| 4 | E | 20 | U | 36 | k | 52 | 0 |
| 5 | F | 21 | V | 37 | l | 53 | 1 |
| 6 | G | 22 | W | 38 | m | 54 | 2 |
| 7 | H | 23 | X | 39 | n | 55 | 3 |
| 8 | I | 24 | Y | 40 | o | 56 | 4 |
| 9 | J | 25 | Z | 41 | p | 57 | 5 |
| 10 | K | 26 | a | 42 | q | 58 | 6 |
| 11 | L | 27 | b | 43 | r | 59 | 7 |
| 12 | M | 28 | c | 44 | s | 60 | 8 |
| 13 | N | 29 | d | 45 | t | 61 | 9 |
| 14 | O | 30 | e | 46 | u | 62 | + |
| 15 | P | 31 | f | 47 | v | 63 | / |
❓ Base64 Encoder FAQ
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into an ASCII string format using 64 printable characters (A-Z, a-z, 0-9, +, /). It is commonly used to encode data for transmission over text-based protocols.
Why is Base64 used?
Base64 is used to safely transmit binary data over text-based protocols like HTTP, SMTP, and JSON. It ensures that binary data remains intact without modification during transmission. Common uses include email attachments, embedding images in HTML/CSS, and encoding credentials.
How do I encode text to Base64?
Select the "Encode" mode, enter your text in the input field, and click the Convert button. The tool will instantly display the Base64-encoded version of your text. For example, "Hello, World!" becomes "SGVsbG8sIFdvcmxkIQ==".
How do I decode Base64 to text?
Select the "Decode" mode, enter your Base64 string in the input field, and click the Convert button. The tool will decode the Base64 back to plain text. For example, "SGVsbG8sIFdvcmxkIQ==" becomes "Hello, World!".
What is the Base64 alphabet?
The Base64 alphabet consists of 64 characters: A-Z (26), a-z (26), 0-9 (10), plus (+) and slash (/). The equals sign (=) is used for padding to ensure the encoded string length is a multiple of 4.
What is Base64 padding?
Padding is added to Base64 encoded strings to make the length a multiple of 4. If the input data is not a multiple of 3 bytes, one or two "=" characters are added at the end. The decoder uses these to determine how much data was in the last group.
Is Base64 encryption or encoding?
Base64 is encoding, not encryption. It does not provide security or confidentiality — it simply converts data from binary to text format. Anyone can decode Base64 back to the original data. For security, use encryption algorithms like AES.
What is the difference between Base64 and UTF-8?
UTF-8 is a character encoding that represents Unicode characters as bytes. Base64 is an encoding scheme that converts binary data to ASCII text. UTF-8 is for text representation, while Base64 is for data transmission.
Can Base64 encode images?
Yes. Images can be encoded to Base64 for embedding directly into HTML, CSS, or JavaScript. This avoids separate image file requests and is commonly used for small images like icons. Example: data:image/png;base64,iVBORw0KGgo...
What is the difference between Base64 and Base64URL?
Base64URL is a variant of Base64 designed for URLs and filenames. It replaces "+" with "-" and "/" with "_", and removes the padding "=". This makes the encoded string safe for use in URLs without requiring percent-encoding.
What are the common uses of Base64?
Common uses include: email attachments (MIME), embedding images in HTML/CSS (data URIs), JSON web tokens (JWT), HTTP Basic Authentication, storing binary data in databases, and transmitting binary data over text-based protocols.
How do I encode special characters with Base64?
Base64 works with binary data, so special characters like emojis and non-ASCII characters are first converted to UTF-8 bytes before encoding. The tool handles this automatically — just enter your text and it will be properly encoded.
What is the maximum size for Base64 encoding?
There is no theoretical maximum size. However, Base64 encoding increases the data size by about 33% compared to the original binary data. The browser's built-in functions can handle large amounts of data, but very large files may affect performance.
Is this Base64 encoder secure?
Yes, this tool is secure because all processing is done locally in your browser. No data is sent to any server. Your text and encoded data stay on your device and are never transmitted or stored.
What is the difference between Base64 and Hex encoding?
Base64 uses 64 characters to represent binary data, making it more compact (about 33% size increase). Hex uses 16 characters (0-9, A-F) to represent each byte as two hexadecimal digits, resulting in a 100% size increase. Base64 is more efficient for larger data.
What is a Base64 data URI?
A Base64 data URI is a way to embed small files (like images or CSS) directly into a web page. The format is: data:[MIME-type];base64,[encoded-data]. For example: data:image/png;base64,iVBORw0KGgo...
How do I decode a Base64 string with padding?
Simply paste the full Base64 string (including the "=" padding characters) into the decoder. The tool will handle the padding automatically and return the correct decoded text.
Can I encode files with this tool?
This tool is designed for text input. For encoding files (images, PDFs, etc.), you would typically need file upload functionality. However, you can copy the file's Base64 representation from other tools and paste it here for decoding.
What is the difference between Base64 and ASCII?
ASCII is a character encoding standard that represents text (letters, numbers, symbols) as numeric codes. Base64 is an encoding scheme that converts binary data to ASCII characters. Base64 uses only ASCII characters to represent any binary data.