Convert text or files to and from Base64, safely handling Unicode.
Encode text or files to Base64 or decode Base64 back to text, with correct UTF-8 handling so emoji and multibyte characters survive the round trip. Invalid Base64 input is caught and explained instead of silently corrupting output.
Base64 turns arbitrary bytes into a string of only 64 printable characters (A-Z, a-z, 0-9, + and /), which is why it shows up everywhere bytes need to survive being embedded in text: email attachments, data: URLs, JWT segments, and Basic Auth headers.
A common bug when encoding text (rather than raw files) is treating a string as if every character were one byte. That silently breaks on emoji and most non-English text, because those characters take multiple bytes in UTF-8. This tool encodes through TextEncoder/TextDecoder rather than the browser's raw btoa/atob, so accented characters, CJK text, and emoji all round-trip correctly.
For file input, we read the file's raw bytes directly and Base64-encode them without ever assuming they're valid text — appropriate for images, PDFs, or any binary format, not just plain text.