🔤

Base64

Base64 is an encoding scheme that transforms binary data into a sequence of printable ASCII characters using a 64-symbol alphabet. It's widely used to transmit binary files through text-based protocols like email, JSON, or URLs.

Examples

  • Text 'Hello' → Base64: SGVsbG8=
  • Image Data URI: data:image/png;base64,iVBORw0KGgoAAAANS...
  • JWT Header: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  • PEM Certificate: -----BEGIN CERTIFICATE----- MIIDXTCCAkW... -----END CERTIFICATE-----
  • MIME Attachment: Content-Transfer-Encoding: base64

FAQ

Why does Base64 increase size by 33%?

Because every 3 bytes (24 bits) convert to 4 characters (32 bits of useful data + ASCII overhead). The 3:4 ratio generates the mathematical increase of 1.333x.

Can I use Base64 to 'hide' sensitive data?

No. Base64 is encoding, not encryption. Anyone can decode it with basic tools. For sensitive data use AES-256, RSA, or other real cryptographic algorithms.

What's the difference between Base64 and Base64url?

Base64url replaces + with - and / with _ to avoid conflicts in URLs and filesystems. It also removes the = padding at the end, making strings safe for any web context.