Developer Tools

Base64 Encode / Decode

Encode text to Base64 or decode a Base64 string back to text. Widely used for email attachments, JWT tokens, data URIs, and binary data transfer over text-based protocols.


[[ labels.error_invalid ]]

Tips

  • The name Base64 comes from using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). The = at the end is a padding character to make the byte count a multiple of 3.
  • JWT (JSON Web Token) encodes its header, payload, and signature using Base64URL — a variant that replaces + with - and / with _ to be URL-safe. The output of this tool differs slightly from JWT tokens.
  • Data URIs in HTML/CSS (data:image/png;base64,iVBOR...) use Base64 to embed assets directly in source code without a separate file request.
  • Base64 is encoding, not encryption. Anyone can decode it instantly without a key. Never use it to protect sensitive information.

FAQ

No. Base64 is encoding, not encryption. Anyone can decode it instantly without a key. Use dedicated algorithms like AES or BCrypt to protect sensitive data.

Yes. This tool uses UTF-8 encoding internally, so any Unicode character — Japanese, Chinese, emoji — is handled correctly.

Base64 converts every 3 bytes into 4 characters, so the output is approximately 33% larger than the original.

Email attachments (MIME), data URIs in HTML/CSS (data:image/png;base64,...), JWT authentication tokens, and binary data transfer over text-based APIs.

Side Note — Base64, Email, and the URL Collision

The biggest driver behind Base64's adoption was email. SMTP in the 1970s–80s could only handle 7-bit ASCII text, so binary attachments would get corrupted in transit. MIME solved this by Base64-encoding binary data into plain text — a convention still used today inside every email attachment.

Base64's character set includes + and /, which have special meanings in URLs. To fix this, Base64URL was invented (+→-, /→_, no padding). JWT and OAuth tokens use Base64URL, which is why they look slightly different from standard Base64.

Converting 3 bytes of binary into 4 Base64 characters means the output is about 33% larger than the input. Embedding large images as data URIs bloats HTML files significantly — it's fine for small icons, but not recommended for larger assets.