Developer Tools

Base64 Encode / Decode

Encode text to Base64 or decode Base64 to text instantly.

Enter text above to see the Base64 output

What Is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, and /). It's used whenever you need to transmit binary data through systems that only handle text.

The name "Base64" comes from the fact that it uses a 64-character alphabet. Every 3 bytes of input become 4 Base64 characters, making the encoded output about 33% larger than the original.

Why Is Base64 Used?

Email Attachments — Email protocols (SMTP) were designed for plain text. Base64 lets you embed images, PDFs, and other binary files in email messages.

Data URLs — You can embed small images directly in HTML and CSS using Base64 data URLs like data:image/png;base64,.... This eliminates an extra HTTP request.

API Payloads — Many APIs use JSON, which doesn't natively support binary data. Base64 lets you include binary content (images, files) in JSON payloads.

Basic Authentication — HTTP Basic Auth encodes the username:password pair in Base64 before sending it in the Authorization header.

Storing Binary in Text Fields — When databases or config files only accept text, Base64 lets you store binary data as a text string.

How to Use This Tool

  1. Select your mode — Encode or Decode.
  2. Paste your input — plain text to encode, or a Base64 string to decode.
  3. See the result instantly as you type.
  4. Swap to reverse the direction, or Copy the output.

All conversion happens in your browser. No data is sent anywhere.

Base64 Character Set

Base64 uses exactly 64 characters plus a padding character:

  • A–Z (26 characters)
  • a–z (26 characters)
  • 0–9 (10 characters)
  • + and / (2 characters)
  • = (padding, used to make the output length a multiple of 4)

There's also a URL-safe variant that replaces + with - and / with _ to avoid issues in URLs.

Base64 Encoding in Different Languages

Most programming languages have built-in Base64 support:

  • JavaScriptbtoa() to encode, atob() to decode
  • Pythonbase64.b64encode() and base64.b64decode()
  • JavaBase64.getEncoder().encode() and Base64.getDecoder().decode()
  • Goencoding/base64 package
  • Command linebase64 command on macOS/Linux

Important Notes

  • Base64 is not encryption. It's encoding — anyone can decode it. Never use Base64 to "hide" sensitive data.
  • Base64 output is always about 33% larger than the input. It's not a compression format.
  • This tool supports full Unicode (including emoji and non-Latin characters) by encoding through UTF-8 first.

Frequently Asked Questions

Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string without a key. It's used for data transport, not security.
Why is the Base64 output longer than the input?
Base64 represents every 3 bytes of input as 4 characters. This means the output is always about 33% larger than the original data.
Does this tool support Unicode and emoji?
Yes. The tool encodes text through UTF-8 before Base64 encoding, so it correctly handles Unicode characters, accented letters, and emoji.
Is my data sent to a server?
No. All encoding and decoding happens locally in your browser. Your data never leaves your device.