Base64 Encoder / Decoder

Input
Output

What is Base64?

01 Definition

Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format. It is NOT an encryption algorithm. Its primary purpose is to convert binary data (like images, audio, files) into text format for safe transmission over text-only protocols.

Index Table
A-Z (26), a-z (26), 0-9 (10), +, / (Total 64 chars)
Note: The equals sign (=) is used only for padding.

02 How it Works

Base64 splits every 3 bytes (3 × 8 = 24 bits) of data into 4 groups (4 × 6 = 24 bits). Each 6-bit value (0-63) maps to a character in the Base64 index table.

Original M a n
ASCII 77 97 110
Binary 01001101 01100001 01101110
6-bit Group 010011 010110 000101 101110
Base64 T W F u

This is why Base64 encoded data is typically 1/3 (approx 33%) larger than the original data.

03 Common Scenarios

  • Data URI Scheme Embedding small images directly in HTML/CSS (e.g. data:image/png;base64,...) to reduce HTTP requests.
  • Email Attachments (MIME) SMTP was designed for 7-bit ASCII. Base64 allows sending binary files like images and PDFs via email.
  • API Data Transfer Transmitting binary data (like avatar uploads) in text-based formats like JSON or XML.
  • Simple Obfuscation Hiding config details or text from plain sight (though insecure, it prevents casual reading).

FAQ

Is Base64 encryption?
No. Base64 is an encoding algorithm, not encryption. It is easily reversible. Do not use it to secure sensitive data like passwords without proper hasing.
Why does the size increase?
Base64 encodes 3 bytes of binary data into 4 ASCII characters. This results in an overhead of approximately 33% compared to the original data size.
Why are there "=" signs at the end?
The equals sign = is used for padding. If the binary data length isn't divisible by 3, padding characters are added to complete the final block of 4 characters.
Does it support UTF-8 / Unicode?
Yes. Our tool properly handles multi-byte characters (like Chinese, Emojis) by first encoding the string to UTF-8 bytes before applying Base64 encoding.
What is "URL Safe" Base64?
Standard Base64 uses `+` and `/` which can cause issues in URLs. URL-safe Base64 replaces `+` with `-` and `/` with `_`, and omits the padding `=` signs.
Is my data processed locally?
Yes, 100%. All encoding and decoding happen directly in your browser using JavaScript. No data is ever sent to our servers.
How to convert Image to Base64 in JS?
You can use the FileReader API with the readAsDataURL() method. This is useful for previewing uploaded images.
When was it invented?
Base64 was first defined in 1987 in RFC 989 for email privacy, and later standardized in MIME (RFC 2045) for encoding binary attachments in emails.

More Free Tools