Encode and decode Base64 instantly
Base64 shows up everywhere in development work: data URIs, API tokens, email attachments, JWT parts and configuration values. This tool converts both ways with full Unicode support, so text with accents or emoji survives the round trip. Decoding validates the input and explains the problem if the string is not valid Base64.
A quick example
The word "Hello" encodes to SGVsbG8=. Notice the output is about a third longer than the input; that size increase is the normal cost of representing bytes in a text-safe alphabet.
How Base64 works under the hood
Computers store text as bytes, and each byte can hold 256 different values, many of which are invisible control characters that break when they pass through email systems, URLs or older protocols. Base64 solves this by regrouping the data. It takes your bytes three at a time, which is 24 bits, and splits them into four groups of 6 bits. Each 6 bit group names one character from a safe alphabet of 64: the capital letters, the lowercase letters, the digits, plus and slash. Four safe characters now carry what three raw bytes held, which is why the output grows by about a third. This tool first turns your text into UTF-8 bytes, the universal way to represent characters from every language, so an accented letter or an emoji becomes two to four bytes before encoding and comes back exactly as it started. When decoding, the process runs in reverse, and the tool checks the characters and length first, then confirms the decoded bytes really are valid UTF-8 before showing you the result.
Practical tips for everyday use
- Decode before you trust: if a link, token or config value contains a long Base64 looking string, decode it here to see the plain text it carries before pasting it anywhere sensitive.
- Expect the size increase: budget about 33 percent more space for encoded data. A 300 KB image becomes roughly 400 KB as a data URI, which matters for page weight and email limits.
- Keep padding intact: the equals signs at the end are part of the data. Some systems accept strings without them, but many decoders fail, so copy the full string including padding.
- Watch for the URL safe variant: Base64 meant for web addresses swaps plus for minus and slash for underscore. If decoding fails on a string full of those two characters, it is probably the URL safe flavor.
- Decode in layers when data is nested: JSON web tokens and some config formats encode more than once. If the decoded result still looks like Base64, run it through the decoder a second time.
A worked example with real values
Take the short text ToolNest, eight characters. Encoding produces VG9vbE5lc3Q=, twelve characters plus padding behavior you can verify above. Now picture a practical job. A settings file needs to carry the text admin@example.com inside a URL, where the at sign and dots can cause trouble in some parsers. Encoded, it becomes YWRtaW5AZXhhbXBsZS5jb20=, a single safe token with no special characters at all, and any system that receives it can decode it back to the exact address. Scale that idea up and you have how email attachments travel: the file bytes are encoded into lines of safe text, sent through systems designed only for text, and rebuilt byte for byte at the other end. Nothing about the content is hidden in the process, it is simply repackaged so text only channels can carry it without damage.
Common mistakes to avoid
- Treating Base64 as security: it hides nothing. A password stored in Base64 is a password anyone can read in seconds, as this very tool demonstrates.
- Truncating the string: copying a selection that misses the first or last characters produces garbage or an error. Base64 length must be a multiple of four once padding is counted.
- Letting line breaks and spaces confuse strict parsers: email style Base64 is often wrapped every 76 characters. This decoder ignores whitespace, but some systems do not, so remove stray breaks before feeding encoded text to rigid tools.
- Encoding already encoded text by accident: double encoding is a frequent bug when data passes through two layers of code. If decoding once gives you another neat Base64 string, you have probably found it.
- Expecting it to compress anything: Base64 always makes data larger, never smaller. Compress first with a real compression tool, then encode the result if it needs to travel as text.
Base64 strings often live inside JSON. When a decoded payload needs tidying, paste it into the JSON Formatter to validate and pretty print it.