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
- Select your mode — Encode or Decode.
- Paste your input — plain text to encode, or a Base64 string to decode.
- See the result instantly as you type.
- 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:
- JavaScript —
btoa()to encode,atob()to decode - Python —
base64.b64encode()andbase64.b64decode() - Java —
Base64.getEncoder().encode()andBase64.getDecoder().decode() - Go —
encoding/base64package - Command line —
base64command 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.