Base64 Encoder / Decoder
Encode plain text or binary data to Base64, or decode a Base64 string back to readable text. Supports full Unicode and UTF-8. Nothing is uploaded — runs entirely in your browser.
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data as a sequence of printable ASCII characters. It uses an alphabet of 64 characters: uppercase letters A–Z, lowercase letters a–z, digits 0–9, and the symbols + and /, plus = for padding. Every 3 bytes of input becomes 4 Base64 characters, which is why Base64-encoded data is approximately 33% larger than the original.
This tool encodes and decodes in your browser — nothing is uploaded to any server. It handles full Unicode and UTF-8, so emoji, accented characters, and non-Latin scripts all encode and decode correctly.
Encode vs Decode
- Encode (Text → Base64) — converts plain text into a Base64 string. The output contains only safe ASCII characters, making it suitable for embedding in URLs, JSON, HTML attributes, and anywhere that cannot safely contain raw binary.
- Decode (Base64 → Text) — reverses the process, taking a Base64 string and recovering the original text. The input must be valid Base64 — if it contains characters outside the Base64 alphabet (other than whitespace), decoding will fail.
Common uses of Base64 encoding
- HTTP Basic Authentication — the
Authorizationheader encodes credentials asusername:password→ Base64. For example:Authorization: Basic dXNlcjpwYXNz. - Data URIs — embedding images, fonts, or other binary files directly in CSS or HTML using the
data:image/png;base64,…URI scheme, eliminating additional HTTP requests. - JWT tokens — the header and payload sections of a JSON Web Token are Base64URL-encoded (a URL-safe variant that replaces
+with-and/with_). - Email MIME encoding — binary attachments in emails are Base64-encoded because SMTP was designed for 7-bit ASCII text.
- API payloads — encoding binary data (images, files, signatures) for inclusion in JSON request or response bodies which require string values.
- Environment variables — encoding multi-line certificates, private keys, or JSON config blobs as a single-line Base64 string for storage in environment variables.
Base64 vs Base64URL
Standard Base64 uses + and / which are special characters in URLs. Base64URL is a URL-safe variant that replaces + with - and / with _, and omits the = padding. Base64URL is used in JWTs, OAuth tokens, and anywhere a Base64 value appears in a URL or filename. This tool uses standard Base64. If you need to decode a JWT payload, use the JWT Decoder which handles Base64URL automatically.
Why does Base64 add ~33% overhead?
Base64 encodes every 3 bytes (24 bits) as 4 ASCII characters (each representing 6 bits). 3 bytes → 4 characters = 4/3 ≈ 1.33× the original size. With line breaks and padding, real-world overhead is typically 33–37%. This size increase is the trade-off for making binary data representable as plain text.