Base64 Encode / Decode
Encode text to Base64 or decode Base64 strings instantly
All processing happens in your browser — no data is sent to any server
Plain Text
Text to encode
Base64 Output
Encoded result
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It was designed to safely transmit binary data through channels that only support text, such as email (MIME), URLs, and HTTP headers.
Base64 works by taking groups of 3 bytes (24 bits) and splitting them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters. If the input isn't divisible by 3, the output is padded with = characters. This means Base64 encoding increases the data size by approximately 33%.
Common Uses for Base64
HTTP Basic Authentication
The HTTP Basic auth scheme encodes username:password in Base64 and sends it in the Authorization header. This is encoding, not encryption — Base64 is trivially reversible and provides no security on its own. Always use HTTPS.
JWT Token Payloads
JSON Web Tokens (JWTs) encode their header and payload sections as Base64url (a URL-safe variant). Decoding the payload reveals claims like user ID, roles, and expiration time without needing the secret key.
Data URIs in HTML/CSS
Small images, fonts, or other assets can be embedded directly in HTML or CSS asdata:image/png;base64,... URIs. This eliminates extra HTTP requests at the cost of larger HTML size.
Email Attachments (MIME)
Email protocols (SMTP) only support 7-bit ASCII text. Binary attachments (images, PDFs, documents) are Base64-encoded for safe transmission and decoded by the receiving email client.
Base64 vs Base64url
Standard Base64 uses + and / characters, which have special meanings in URLs. Base64url (RFC 4648 §5) replaces them with - and_, and typically omits the = padding. This variant is used in JWTs, URL parameters, and filename-safe contexts.
| Variant | Alphabet | Padding | Common Use |
|---|---|---|---|
| Base64 | A-Z, a-z, 0-9, +, / | = padding | Email (MIME), data URIs, PEM certificates |
| Base64url | A-Z, a-z, 0-9, -, _ | No padding | JWTs, URL parameters, filenames |
Important: Base64 Is Not Encryption
Base64 is an encoding scheme, not an encryption or hashing algorithm. Anyone can decode Base64 instantly — it provides zero confidentiality. Never use Base64 to “hide” passwords, tokens, or sensitive data. If you need to protect data, use proper encryption (AES, RSA) or hashing (bcrypt, Argon2).
Related Tools
Built by JDApplications