Encoding Text and Files to Base64 Inside Your Browser
Base64 takes raw bytes and turns them into 64 plain ASCII characters (A-Z, a-z, 0-9, +, /) so binary data or special characters can travel safely inside JSON, YAML, HTML, or email headers. Whether you search for Base64 encoding, 64 encode, or code64 encode, everything here runs in your own browser tab—nothing is uploaded to a server.
Why window.btoa() crashes on emojis and non-English text
If you open your browser console and run btoa("Hello 🌿"), JavaScript throws InvalidCharacterError. That happens because btoa() only accepts single-byte Latin-1 characters.
Here, your text goes through TextEncoder first to get raw UTF-8 bytes, and those bytes are encoded to Base64 (SGVsbG8g8J+Mvw==). So emojis, Hindi, Arabic, and accented letters encode cleanly every time.
Which toolbar options should you tick?
- URL-Safe (- / _) — tick this if the Base64 string is going into a URL, query parameter, or filename.
- No Padding (=) — tick this for JWTs or URLs so you do not get
%3Dat the end. - Wrap 76 chars — only needed for old MIME email bodies or PEM-style text blocks.
- Line-by-Line — encodes each line separately instead of one big block.
Need to turn Base64 back into readable text or files? Jump over to 64Decode.