Base64 Encoder / Decoder

Encode plain text to Base64, or decode Base64 strings back to readable text instantly.

Advertisement
Advertisement

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts arbitrary binary data into a string of 64 printable ASCII characters. The name reflects the character set: uppercase A–Z, lowercase a–z, digits 0–9, plus the symbols + and /. A 65th character, =, serves as padding. Base64 was developed to allow binary data — images, audio, documents — to pass safely through systems originally designed only for plain ASCII text, such as email (SMTP) and HTTP headers.

How Base64 Works

The encoding process converts every 3 bytes (24 bits) of input into 4 Base64 characters (6 bits each). If the input length is not divisible by 3, one or two = padding characters are added to make the output a multiple of 4. This means Base64-encoded output is always about 33% larger than the original binary data — a deliberate trade-off for safe text transmission.

Where You Encounter Base64

  • Email attachments (MIME): SMTP was designed for 7-bit ASCII. Base64 encodes attachments so they survive email transfer.
  • Data URIs in CSS/HTML: Embed images directly as data:image/png;base64,... strings to eliminate an HTTP request.
  • JSON Web Tokens (JWT): JWT headers and payloads are Base64URL-encoded (a URL-safe variant using - and _ instead of + and /).
  • HTTP Basic Authentication: Credentials are sent as Authorization: Basic [base64(user:password)].
  • API responses: Binary files (PDFs, images) embedded in JSON responses as Base64 strings.

Important: Base64 Is Not Encryption

Base64 provides zero security. It is reversible by anyone who knows the scheme, which is publicly documented. Never use Base64 to protect sensitive data — use it only to safely transmit binary over text channels. Always combine with actual encryption when security is required.