Enter the required information
Use the fields in the tool above and keep units and formats consistent.
Encode text to Base64 or decode Base64 strings back to readable text. Learn how padding works, why output grows by 33% and why Base64 is not encryption.
Base64 turns any data, text or binary, into a string of 64 safe characters. These are A-Z, a-z, 0-9, plus + and /. It exists because many systems were designed for plain text. Email bodies, JSON fields and URLs can corrupt raw bytes, but they carry Base64 text without trouble.
This Base64 encoder and decoder works both ways. Encode plain text into Base64, or paste an encoded string to recover the original.
The encoder reads input in groups of 3 bytes, which is 24 bits. It splits those bits into four 6-bit chunks. Each chunk maps to one character in the Base64 alphabet.
| Input text | Bytes | Base64 output |
|---|---|---|
Man | 3 | TWFu |
Hi | 2 | SGk= |
A | 1 | QQ== |
The = signs are padding. They appear when the input length is not a multiple of 3. One = means two bytes were in the last group. Two means only one byte was left. Some systems strip padding entirely. Most decoders cope, or you can add = until the length divides by four.
Because 3 bytes become 4 characters, encoded data is about 33% larger. A 300 KB image turns into roughly 400 KB of Base64 text. That is fine for small icons, but wasteful for large photos.
Anyone can decode Base64 in seconds, with no key. It hides nothing. HTTP Basic Auth headers, for example, carry the username and password only Base64-encoded. That is why such headers must always travel over HTTPS.
If you need to protect data, use real encryption such as AES, or hashing for passwords. Use Base64 only to move bytes safely through text-only channels. A quick test makes the point: paste a "hidden" value into any decoder, and plain text appears instantly.
In JavaScript, btoa() encodes and atob() decodes, but both fail on characters outside Latin-1. Python's base64.b64encode() works on bytes, so call .encode("utf-8") on a string first. On Linux and macOS, the base64 command handles files from the terminal.
data:image/png;base64,...+ and / for - and _.If decoding returns garbled symbols, the source was probably binary, such as an image, rather than text. Also check for Base64URL characters or missing padding. For Hindi text or emoji, check that the ToolsMate Base64 encoder, or any tool you use, works in UTF-8. Otherwise decoded text may come back garbled.
Use the fields in the tool above and keep units and formats consistent.
Review the result shown in the output area.
Confirm that the result matches your situation before using it for a decision.
UTF-8 text is encoded to Base64.This describes the core logic used by the tool. Check any assumptions that may affect your result.
Use accurate inputs and keep units consistent.
Review the assumptions before using the result for a decision.
Compare important results with an independent or official source.
No, Base64 provides no security because anyone can reverse it without a key or password. It is a way of representing data as text. Use encryption such as AES when you need to keep information private.
The equals signs are padding that keep the output length a multiple of four characters. One equals sign means the final group held two bytes. Two equals signs mean it held only one byte.
Base64 output is roughly 33% larger than the input because every 3 bytes become 4 characters. Line breaks added by some encoders, such as MIME email encoders, increase the size a little more.
Base64URL replaces the plus sign with a hyphen and the slash with an underscore, and it often drops the padding. These changes make the string safe inside URLs and filenames. JWT tokens use this variant.
You can read the header and payload by decoding each dot-separated part as Base64URL. Decoding does not verify the signature, though. Never trust the claims in a token until your server has validated it.
The original data was probably binary, such as an image or PDF, which cannot display as readable text. Another cause is a character set mismatch, where UTF-8 text was decoded as Latin-1 or a similar encoding.
Inline Base64 works well for tiny icons under a few kilobytes because it saves an HTTP request. Larger images bloat your CSS, cannot be cached separately, and usually slow page load, so serve those as normal files.
Explore other useful tools across the site.