Skip to main content
I
Uni
UNICODE
Tools/Base64

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.

73 BRaw UTF-8 Byte Size
100 CharsBase64 String Length
+37%Base64 Expansion Ratio
standardActive Encoder Mode
Encoding Specification / Target:
Quick Presets:
Font Size (16px):
UTF-8 Unicode Text (To Encode)Live Input Buffer
Base64 Encoded Output
SGVsbG8gV29ybGQg8J+agCEgVVRGLTggTXVsdGktQnl0ZSBTdHJpbmcgd2l0aCBVbmljb2RlIDE2LjAgJiBTeW1ib2xzIOKYhQ==

24-Bit Quantum Chunk Anatomy (3 Bytes → 4 Base64 Characters)

Input Chars8-Bit Raw Bytes (Hex / Decimal)6-Bit Base64 Output
Hel0x48 (72), 0x65 (101), 0x6C (108)SGVs
lo 0x6C (108), 0x6F (111), 0x20 (32)bG8g
Wor0x57 (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

Standard library base64 encoding and decoding.

1import base64
2
3text = "Hello, Unicode! 🌍 (Urdu: سلام)"
4
5# 1. Base64 Encode (UTF-8 bytes to ASCII base64)
6encoded = base64.b64encode(text.encode('utf-8')).decode('ascii')
7print("Encoded:", encoded)
8
9# 2. Base64 Decode back to Unicode String
10decoded = base64.b64decode(encoded).decode('utf-8')
11print("Decoded:", decoded)
Python 3Zero external runtime dependencies • Standard Library
UTF-8 & Unicode 16.0 Compatible

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):

• 6-Bit Alphabet (64 Glyphs): A-Z (0–25), a-z (26–51), 0-9 (52–61), + (62), / (63).
• Padding Characters: If the input length is not a multiple of 3 bytes, = or == padding is appended to fill the 24-bit quantum block.
• Size Overhead: Exactly $4 / 3 = 1.333$ (+33.33% expansion in data transmission).

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.