iloveweb.tools
iloveweb.tools

Base64 Encode/Decode

Convert text to Base64 encoding or decode Base64 strings. Essential for data URLs, API payloads, and email attachments.

Plain Text
Base64 Output

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of 64 ASCII characters. It's one of the most widely used encoding methods on the internet, essential for transmitting data over channels designed for text.

The "64" in Base64 refers to the 64 unique characters it uses: A-Z, a-z, 0-9, + and /. Padding characters (=) are added when the input isn't divisible by 3 bytes.

How Base64 Encoding Works

Base64 takes 3 bytes (24 bits) of binary data and represents them as 4 ASCII characters. Here's a simplified breakdown:

  1. Convert input text to binary
  2. Split into 6-bit chunks (instead of 8-bit bytes)
  3. Map each 6-bit chunk to one of 64 characters
  4. Add padding if needed
Example:
Input: Hello
Base64: SGVsbG8=

Common Use Cases

Use CaseExample
Data URLsEmbed images in HTML/CSS: data:image/png;base64,...
Email AttachmentsMIME encoding for binary files in emails
HTTP Basic AuthEncode username:password pairs
JWT TokensBase64URL encoding for JSON payloads
API PayloadsStore binary data in JSON strings

⚠️ Base64 is NOT Encryption

Base64 is encoding, not encryption. Anyone can decode Base64 strings instantly. Never use it to hide passwords or sensitive data. For security, use actual encryption algorithms like AES or RSA.

Base64 Size Overhead

Base64 encoding increases data size by approximately 33%. This is the trade-off for text-safe transmission:

  • 3 bytes of input → 4 characters of Base64 output
  • A 3KB file becomes ~4KB when encoded
  • Consider this when embedding large images as data URLs

Frequently Asked Questions

What's the difference between Base64 and Base64URL?

Base64URL replaces + with - and / with _ to make the output URL-safe. It's used in JWTs and other web applications where the encoded string appears in URLs.

Can I encode images with this tool?

This tool is designed for text. To encode images, you'd need to first read the file as binary data. Many online tools offer image-to-Base64 conversion specifically.

Is the encoding reversible?

Yes! Base64 is 100% reversible. Every encoded string can be decoded back to its original form with no data loss. That's what makes it useful for data transmission.

Why does my Base64 output end with =?

The = padding is added to make the output length a multiple of 4. One = means 2 bytes of padding; two == means 1 byte of padding. Some implementations omit padding.