Convert Unicode to Base64
Encode Unicode text to Base64 (and decode) with standard, URL-safe, MIME variants. UTF-8 proper. Free, offline, client-side, secure.
Encode Unicode text to three Base64 variants: standard (+/ with = padding), URL-safe (-_ for use in URLs and filenames), and MIME (76-char wrapped per RFC 2045). Reverse direction auto-detects the variant. Proper UTF-8 throughout - emoji and non-ASCII roundtrip correctly.
How to Use Convert Unicode to Base64
- Paste your Unicode text. Any characters work - ASCII, accented Latin, Greek, Cyrillic, CJK, emoji. The encoder calls
TextEncoder.encode()to produce proper UTF-8 bytes first, then applies Base64. Roundtripping through both directions preserves every character exactly. - Pick a Base64 variant. Standard (RFC 4648 ยง4) uses
A-Z a-z 0-9 + /with=padding - universal default. URL-safe (RFC 4648 ยง5) replaces+ /with- _so the result is safe in URLs, filenames, and JSON Web Tokens. MIME uses the standard alphabet but wraps every 76 characters withrn(per RFC 2045 for email body line limits). - Toggle padding. On (default) keeps the
=characters at the end. Off strips them - saves a few bytes, common in URL-safe variants where=would need URL-encoding to%3D. Decoding handles both with or without padding automatically. - Read the stats. Shows input character count, UTF-8 byte count (different for multi-byte chars), Base64 character count, and the expansion ratio. Base64 always expands data by 4/3 (โ1.33ร) so 100 UTF-8 bytes โ 136 Base64 chars (with padding). Useful for understanding why your encoded payload is bigger than expected.
- Swap to decode. โ flips to Base64 โ Unicode. The decoder auto-detects variant by scanning for distinctive characters (
-_for URL-safe,rnfor MIME). It strips whitespace, converts URL-safe back to standard internally, auto-pads to a multiple of 4 if missing, then runsatobandTextDecoderwith strict UTF-8 mode (errors on invalid byte sequences). - Batch mode. Multiple input lines become rows in a TSV. Encoding: Input / Base64 / InputChars / UTF-8 Bytes / Base64 Length. Decoding: Input / Decoded / Variant / Bytes. Useful for processing a column of values from a database export where each row needs independent encoding.
- Copy or Download. Single conversion downloads as
unicode-base64.txt. Batch downloads asunicode-base64.tsvopening in spreadsheets with proper columns.
Frequently Asked Questions
What’s the difference between standard, URL-safe, and MIME Base64?
All three use the same 64-character alphabet logically but spell it differently. Standard uses + and / for indices 62 and 63, with = as padding. URL-safe swaps those to - and _ (because +, /, and = have special meanings in URLs and filenames). MIME uses the standard alphabet but wraps every 76 characters with rn – required by RFC 2045 for email body line lengths. All three are losslessly inter-convertible.
How does it handle emoji and non-ASCII?
Properly. The encoder calls TextEncoder.encode() first to convert the input string into UTF-8 bytes – so ๐ (U+1F30D) becomes 4 bytes F0 9F 8C 8D. Then those bytes go through standard Base64. The decoder reverses: atob โ byte array โ TextDecoder('utf-8', {fatal: true}). Strict UTF-8 mode throws on invalid byte sequences instead of silently producing U+FFFD replacement characters.
Why does my encoded text look the same in URL-safe and standard variants?
Because your specific input happens not to produce + or / characters in the output. Whether those appear depends on which bit patterns your data produces. For short ASCII text, you often won’t see them. Try encoding ?>< or other characters that produce bit patterns mapping to indices 62/63 - you'll see + and / in standard, - and _ in URL-safe.
What happens when I decode Base64 without padding?
The decoder auto-pads to a multiple of 4 with = characters before running atob. So SGVsbG8 (7 chars) becomes SGVsbG8= (padded to 8) before decoding. Most modern Base64 producers omit padding (especially URL-safe variants) and most decoders accept that, including this one.
What's the decode auto-detect?
The decoder scans the input for distinguishing characters: presence of - or _ โ URL-safe variant. Presence of rn or other whitespace โ MIME variant. Neither โ standard. The detected variant is reported in the stats line so you can see what the decoder thought you gave it. All variants get internally normalized to standard before atob.
Does decoding handle URL-safe Base64 too?
Yes - automatic. The decoder doesn't require you to manually specify the variant; it detects URL-safe by the presence of - or _, internally converts those to + and /, then decodes normally. So you can paste a JWT payload directly and it just works.
What's the input size limit?
500,000 characters. Encoding is fast (browser btoa is native), so the cap is mostly about browser memory rather than algorithm performance. Encoded output for 500K input is roughly 670K characters - still manageable for browsers but you don't want to go much higher in a textarea.
What error do I get from invalid Base64?
Specific. "Invalid Base64 character 'X' at position N" for non-alphabet characters. "atob failed" for structural errors like wrong padding. "Decoded bytes are not valid UTF-8" when the base64 decodes to bytes that aren't a valid UTF-8 sequence (would happen if you encoded binary data with this tool, not just text). The stats line preserves the previous result if you want to recover.
Is my data uploaded anywhere?
No. All UTF-8 encoding, Base64 encoding (btoa), Base64 decoding (atob), and UTF-8 decoding run in your browser. Open DevTools โ Network and confirm zero requests fire - even when you Convert or Download. Safe for tokens, credentials, sensitive text, or anything you'd rather not send to a third-party converter.
Does it work offline?
Yes. Total bundle is about 18 KB. Load once, disconnect, keep using. btoa, atob, TextEncoder, and TextDecoder are all part of the browser's standard library - no remote dependencies. Useful for processing data on airgapped systems or in offline environments.