Encode text or files to Base64 and decode Base64 strings back. Supports images, files, and Unicode text.
Base64 is a binary-to-text encoding scheme that converts arbitrary binary data into a string of 64 printable ASCII characters. It was invented to solve a specific problem: older communication protocols (email, HTTP headers, XML attributes) were designed to carry text — but developers needed to transmit binary data (images, files, cryptographic keys) through those same channels without the binary bytes getting corrupted or misinterpreted as control characters.
The solution was to re-encode every 3 bytes of binary data as 4 ASCII characters using an alphabet of 64 safe characters: A–Z, a–z, 0–9, +, and /. The result is a larger string (roughly 33% overhead) but one that travels safely through any text-based protocol or data format.
The encoding algorithm processes input bytes in groups of three:
= characters to make it a multiple of 4Example: The string Man (bytes: 77 97 110 in decimal, or 01001101 01100001 01101110 in binary) encodes to TWFu. The three bytes provide 24 bits → four 6-bit groups (010011 / 010110 / 000101 / 101110) → values 19, 22, 5, 46 → characters T, W, F, u.
| Use Case | What Gets Encoded | Why Base64 |
|---|---|---|
| Email attachments (MIME) | PDF, image, zip files | SMTP is text-only |
| Data URIs in HTML/CSS | Small images, fonts | Embed assets inline, eliminating HTTP requests |
| JWT tokens | JSON payload + signature | URL-safe transport (uses Base64url variant) |
| API authentication | username:password | HTTP Basic Auth header format |
| Cryptographic keys | SSL certificates, SSH keys | PEM format stores keys as Base64 between headers |
| XML / JSON payloads | Binary file contents | XML/JSON cannot contain raw binary bytes |
Base64 and URL encoding are both text-safe encoding schemes but serve different purposes:
+ with - and / with _ and omits padding — used in JWTs and URL path segmentsNo. Base64 is encoding, not encryption. Anyone who receives a Base64 string can decode it instantly with no key. It provides zero security. Never use Base64 to "hide" passwords, API keys, or sensitive data — use proper encryption (AES-256) or hashing (bcrypt for passwords) instead.
Base64 works in groups of 3 bytes. If the input is not divisible by 3, padding characters (=) are added to make the output length a multiple of 4. One = means the last group had 2 bytes; == means 1 byte. Padding ensures decoders know exactly how many bytes of real data are present.
A JWT has three parts separated by dots: header.payload.signature. Copy the payload section (the middle part) and paste it into the decoder. Note: JWT uses Base64url encoding, so you may need to replace - with + and _ with / before decoding, then add = padding if needed. The decoded JSON will show you the token's claims.
The text encoder/decoder works with text strings. For encoding binary files to Base64 (for data URIs or API payloads), use the file upload mode which reads the file as binary and produces the complete Base64 string including the data URI prefix (e.g., data:image/png;base64,...).
Yes — Base64 increases data size by approximately 33% because every 3 bytes becomes 4 characters. A 1 MB image encodes to roughly 1.37 MB of Base64 text. This overhead is acceptable for small assets (icons, small images in CSS data URIs) but makes Base64 impractical for large file transfer where you should use multipart form upload instead.