Encode text or files to Base64, or decode Base64 back to plain text — instantly, in your browser.
All processing happens in your browser — no data is sent to any server
Plain Text
0 chars
Invalid Base64 — contains characters outside the Base64 alphabet.
Base64
0 chars
File Encoder
Drop any file here to encode as Base64
or
——
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 /. The name comes from the 64-character alphabet.
It was designed to safely transmit binary data (like images or executables) over channels that only handle plain text — such as email (MIME), HTTP headers, and JSON APIs. Base64 is an encoding, not encryption: anyone can decode it instantly.
Common Use Cases
🔑
API Tokens & Auth Headers
HTTP Basic Auth encodes username:password as Base64 in the Authorization header. Many API keys are Base64-encoded byte sequences.
🪙
JWT Tokens
JSON Web Tokens (JWTs) use URL-safe Base64 to encode the header, payload, and signature. The three parts are separated by dots.
🖼️
Data URIs (Inline Images)
CSS and HTML can embed images directly using data:image/png;base64,… — no separate HTTP request needed for small icons and logos.
📧
Email Attachments (MIME)
Email protocols (SMTP) are text-only. MIME encodes binary attachments as Base64 so they survive transmission through mail servers.
📦
JSON Payloads
APIs that need to include binary data (certificates, keys, file bytes) in a JSON body Base64-encode the binary into a string field.
🔒
Cryptographic Keys
PEM certificates and SSH public keys are Base64-encoded DER structures wrapped in -----BEGIN … ----- headers.
Standard vs. URL-safe Base64
Standard Base64 uses + and / as the 62nd and 63rd characters, and = for padding. These characters have special meaning in URLs, so URL-safe Base64 (RFC 4648 §5) swaps them:
+ → - (hyphen)
/ → _ (underscore)
= padding is omitted
URL-safe Base64 is used in JWTs, OAuth tokens, and any situation where the encoded string appears in a URL or filename.
How Base64 Works
Base64 groups input bytes into 3-byte chunks and converts each chunk into 4 Base64 characters (each representing 6 bits). This is why the output is always 4/3 ≈ 33% larger than the input.
When the input length is not a multiple of 3, one or two = padding characters are appended to keep the output length a multiple of 4.