Base64 Decoder & Encoder

Free online tool to decode and encode Base64 strings. Perfect for developers working with encoded data.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used to encode binary data that needs to be stored and transferred over media that are designed to deal with text.

Base64 encoding works by dividing the input into 3-byte (24-bit) chunks, which are then converted into four 6-bit numbers. These 6-bit numbers are then used as indices into an array of 64 printable characters, typically A-Z, a-z, 0-9, +, and /.

When the number of bytes to encode is not divisible by 3, padding with '=' characters is used to ensure the encoded data is always a multiple of 4 characters long.

Learn more about how Base64 encoding works →

Common Uses of Base64 Encoding

  • Encoding binary data in emails (MIME)
  • Embedding image data in CSS or HTML
  • Storing complex data in JSON
  • URL-safe data encoding
  • Encoding authentication credentials
  • Transferring binary data through text-only protocols

Base64 Encoding Examples

Text Example

Text: Hello World
Base64: SGVsbG8gV29ybGQ=

Data URI Example

Base64 is commonly used in data URIs to embed images directly in HTML or CSS:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==

Technical Details

Base64 uses a set of 64 characters (hence the name) to represent binary data:

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

There's also a URL-safe variant of Base64 that uses "-" and "_" instead of "+" and "/" to avoid URL encoding issues.

Important Considerations

  • Base64 encoding increases the data size by approximately 33% (4 characters for every 3 bytes)
  • It's not a form of encryption - Base64 encoded data can be easily decoded
  • Base64 is commonly used in combination with other encoding schemes like UTF-8
  • The padding character '=' ensures the encoded length is always a multiple of 4

Performance Tip

When working with large binary files, consider using streaming Base64 encoding/decoding to minimize memory usage. Most modern programming languages provide built-in Base64 encoding functions that handle this efficiently.