Base64 Encoder/Decoder - Complete Guide

Encode and decode Base64 strings online. Learn how Base64 encoding works and when to use it.

1 min read

Encode and decode Base64 strings with our free online tool.

Introduction#

Base64 encoding converts binary data to ASCII text format. It's used for:

  • Embedding images in HTML/CSS
  • Encoding data in URLs
  • Email attachments (MIME)
  • API data transfer
  • Storing binary data in JSON

How to Use#

Encoding#

  1. Go to Base64 Encoder/Decoder
  2. Select Encode mode
  3. Enter your text or data
  4. Copy the Base64 output

Decoding#

  1. Select Decode mode
  2. Paste the Base64 string
  3. View the decoded output

How Base64 Works#

Base64 uses 64 characters:

  • A-Z (26 characters)
  • a-z (26 characters)
  • 0-9 (10 characters)
    • and / (2 characters)
  • = for padding

Every 3 bytes of input become 4 Base64 characters.

Common Use Cases#

Embedding Images#

Convert small images to Base64 for inline CSS/HTML:

.icon {
  background: url('data:image/png;base64,iVBORw0K...');
}

API Authentication#

Encode credentials for Basic Auth:

const auth = btoa(`${username}:${password}`);
// Use in header: `Basic ${auth}`

Data URLs#

Include small files directly in web pages:

<img src="data:image/png;base64,iVBORw0KGgo..." />

Best Practices#

When to Use#

  • Small images (<10KB)
  • Configuration data
  • Simple authentication
  • Embedding in JSON/XML

When NOT to Use#

  • Large files (increases size by 33%)
  • Performance-critical applications
  • Files served separately
  • Already compressed data

Security Notes#

  • Base64 is NOT encryption
  • Anyone can decode Base64
  • Don't use for passwords alone
  • Combine with actual encryption
Was this page helpful?