Base64 turns arbitrary data into plain text using only letters, digits, and two symbols, which is why it shows up everywhere from email attachments to web tokens. This tool encodes and decodes Base64 directly in your browser: pick the Encode or Decode tab, paste your text, and the result appears live as you type. There is no upload, no signup, and no data ever leaves your device, so it is safe for tokens, credentials, and confidential snippets.
Two details set this tool apart from the dozens of converters out there. First, full Unicode support: emoji, Chinese characters, Arabic text, and accented letters all encode correctly because the tool converts your text to UTF-8 bytes before encoding and back again when decoding. Many naive converters silently garble exactly those characters. Second, honest error handling: invalid Base64 input produces a clear message instead of garbage output.
Before using it, one framing worth repeating: Base64 is an encoding, not a form of protection. Anyone can decode it instantly, so never treat a Base64 string as if it were encrypted.
What Is Base64 and How Does It Work?
Base64 represents binary data using exactly 64 text characters: A through Z, a through z, 0 through 9, the plus sign, and the forward slash, with the equals sign reserved for padding. The scheme works on groups of 3 bytes. Three bytes are 24 bits, which split evenly into four groups of 6 bits, and each 6-bit value, 0 to 63, maps to one character of the alphabet. That is the whole trick.
A worked example makes it concrete. The word Man is three bytes: 77, 97, and 110. In binary that is 01001101, 01100001, 01101110. Regrouped into 6-bit chunks you get 010011, 010110, 000101, 101110, which are the decimal values 19, 22, 5, and 46, mapping to the characters T, W, F, and u. So Man encodes to the four-character string TWFu, and every three bytes of input become exactly four characters of output.
That fixed 4-to-3 ratio explains Base64's one universal side effect: the output is about a third larger than the input. Encoding 1 MB of binary data produces roughly 1.37 MB of text. When the final group has only 1 or 2 bytes, the output is padded with one or two equals signs to reach a multiple of 4 characters, which is why valid Base64 strings almost always have a length divisible by 4.
How to Use This Tool (Step by Step)
- Choose the Encode tab to turn text into Base64, or the Decode tab to turn Base64 back into text.
- Paste or type your text. The conversion updates live with every keystroke; there is no submit button to wait for.
- Use the copy button to grab the result, or the swap button to move the output into the input field, which is the fastest way to verify an encode-decode round trip.
- If decoding fails, read the error message. It tells you whether the problem is an invalid character or bad padding rather than just saying error.
- Clear the fields and repeat. Nothing is stored between sessions, and nothing is transmitted anywhere.
Full Unicode Support (the Part Most Converters Get Wrong)
The browser's built-in Base64 functions only handle bytes, and older code paths assume each character is a single byte. That works for plain English but fails for anything else: an emoji is 4 bytes in UTF-8, Chinese characters are typically 3 bytes, and accented letters like ü are 2. Naive converters either throw an error on those characters or, worse, produce a string that decodes into mojibake, the garbage sequences of stray symbols that appear when bytes are interpreted with the wrong text encoding.
This tool does it properly. On encode, your text is first converted to UTF-8 bytes with the TextEncoder API, and those bytes are Base64-encoded. On decode, the bytes are run back through TextDecoder so the original characters come out intact. A concrete example: the emoji grinning face is the 4 UTF-8 bytes F0 9F 98 80, which encode to the 8-character Base64 string 8J+YgA==. Encode it here, decode it back, and you get the same emoji every time, on every device.
Common Base64 Errors and What They Mean
- Invalid character: the input contains something outside the 64-character alphabet, often a stray quote, a Unicode lookalike, or leftover text around the encoded string. Whitespace such as line breaks is usually tolerated and ignored.
- Wrong padding: valid Base64 lengths are multiples of 4, with 1 or 2 trailing equals signs where needed. If a copy-paste dropped the padding, the decoder will refuse it rather than guess.
- Empty input: an empty string encodes to an empty string, which is technically valid but usually means a paste failed.
- Decoded gibberish: the Base64 itself was valid, but the bytes were never UTF-8 text to begin with. If you decode a Base64 image this way, you get binary noise; images and other binary files need a file-oriented tool, not a text decoder.
Where Base64 Is Actually Used
- Data URIs: small images and fonts embedded directly in HTML or CSS, using the familiar data:image/png;base64 prefix, so no extra HTTP request is needed.
- Email attachments: MIME carries binary attachments inside text-based email by Base64-encoding them.
- HTTP Basic authentication: the Authorization header sends username and password joined by a colon and Base64-encoded, which is exactly why it must always travel over HTTPS.
- JSON Web Tokens: the three dot-separated segments of a JWT are Base64 of the header, payload, and signature, which is why anyone can read a JWT payload by decoding it.
- URLs and query parameters: compact identifiers that must survive transport as text, though URLs use a slightly modified alphabet described below.
Limitations and the URL-Safe Variant
Standard Base64 uses plus and forward slash, and both are awkward inside URLs: a plus can be read as a space and a slash breaks path parsing. The URL-safe variant solves this by substituting a minus sign for plus and an underscore for slash, and JWTs additionally drop the padding. If you decode a JWT segment here and get an error, that is why: replace minus with plus, underscore with slash, and add equals signs until the length is a multiple of 4. Also keep the size overhead in mind, roughly 33 percent, which makes Base64 a poor choice for large payloads; it exists to move binary through text channels, not to compress anything. And it bears repeating one last time: decoding is trivial for anyone, so Base64 provides zero confidentiality.
Tips and Best Practices
- Use the swap button to round-trip check: encode, swap, decode, and confirm you recovered your original text exactly.
- When copying encoded output from logs or emails, include the trailing padding and trim any surrounding prose or punctuation first.
- If a decoded result looks like mojibake, the bytes are probably not UTF-8; try to identify the original encoding before concluding the Base64 is corrupt.
- For files and images, use a dedicated file encoder; this tool is deliberately text-only so the behavior stays predictable.
- Remember that sensitive strings in URLs, including Base64 ones, often end up in server logs and browser history, so keep secrets out of both.