Unicode Base64 & Base64URL Studio
Encode Unicode text to standard Base64, URL-Safe Base64URL (for JWTs), and Data URIs, and decode byte streams back to readable UTF-8 text with zero corruption.
24-Bit Quantum Chunk Anatomy (3 Bytes → 4 Base64 Characters)
| Input Chars | 8-Bit Raw Bytes (Hex / Decimal) | 6-Bit Base64 Output |
|---|---|---|
| Hel | 0x48 (72), 0x65 (101), 0x6C (108) | SGVs |
| lo | 0x6C (108), 0x6F (111), 0x20 (32) | bG8g |
| Wor | 0x57 (87), 0x6F (111), 0x72 (114) | V29y |
| ld | 0x6C (108), 0x64 (100), 0x20 (32) | bGQg |
| � | 0xF0 (240), 0x9F (159), 0x9A (154) | 8J+a |
| �! | 0x80 (128), 0x21 (33), 0x20 (32) | gCEg |
UTF-8 Safe Base64 Encoding Ready to Run
Standard library base64 encoding and decoding.
The Mathematics & Bit Architecture of Base64 Encoding (RFC 4648)
Base64 is a binary-to-text encoding scheme that represents raw binary data in an ASCII string format. It transforms 24 bits (3 bytes of 8 bits each) into 4 six-bit groups (6 bits each):
A-Z (0–25), a-z (26–51), 0-9 (52–61), + (62), / (63).= or == padding is appended to fill the 24-bit quantum block.Standard Base64 vs. URL-Safe Base64 (JWT & OAuth PKCE)
- •Standard (RFC 4648 §4): Uses
+and/with=padding. Used for email attachments (MIME) and file transfers. - •Base64URL (RFC 4648 §5): Replaces
+with-and/with_without padding. Essential for JSON Web Tokens (JWT) and URL query safety.
Frequently Asked Questions (FAQs)
Why does native JavaScript btoa() throw an error on Unicode characters?+
The standard browser window.btoa() function treats characters as binary 8-bit Latin1 strings (0x00–0xFF). Characters outside this range (emojis, Urdu, Arabic, Hindi) cause btoa() to fail with an InvalidCharacterError. Our tool uses TextEncoder() to convert strings into raw UTF-8 bytes before encoding.
How do I use Base64 in JSON Web Tokens (JWT)?+
JWT tokens require the "URL-Safe Base64URL" format (without "+" or "/" and without "=" padding). Select the "URL-Safe Base64URL" mode for full JWT compatibility.
Can I decode Data URIs directly?+
Yes! Paste the full "data:text/plain;charset=utf-8;base64,..." string and select "Decode". Our parser automatically strips the header and extracts the underlying text.