Home/Base64 Codec

Base64 Codec

Encode and decode Base64, URL-safe Base64, and Hex — all in your browser using native Web APIs.

Plain Text Input
0 bytes
Base64 Output
0 chars
Format:
Quick examples:
Advertisement

Understanding Base64 Encoding

Base64 Encoding Process (3 bytes → 4 chars)

byte 1byte 2byte 301001101011000010110111024 bits = "Man"split6 bits6 bits6 bits6 bits6 bitsTWFuBase64("Man") = "TWFu"

Base64 is a binary-to-text encoding scheme (defined in RFC 4648) that represents binary data using 64 printable ASCII characters. It groups every 3 bytes (24 bits) of input into 4 groups of 6 bits each, then maps each 6-bit value to a character in the Base64 alphabet (A-Z, a-z, 0-9, +, /).

Base64 Variants

VariantChars 62–63PaddingUse Case
Standard (RFC 4648)+ /= paddingMIME, email, file encoding
URL-Safe (RFC 4648 §5)- _OptionalJWTs, URLs, filenames
Base64url (no padding)- _NoneOAuth 2.0, PKCE, OpenID
MIME (RFC 2045)+ /76-char linesEmail attachments

Common Use Cases

  • HTTP Basic Auth: Authorization: Basic base64(user:password)
  • JWT Tokens: Each section (header/payload/signature) is Base64URL encoded.
  • Data URLs: data:image/png;base64,iVBOR... embeds images in HTML/CSS.
  • Email Attachments: MIME encoding transfers binary files over text-based SMTP.
  • API Payloads: Encode binary blobs (images, PDFs) in JSON strings.