Navigation

HomeImage ToolsCode ToolsMath ToolsDate ToolsGeneratorsUtilities
Color ToolsText ToolsPDF Tools

Unicode to Base64

Encode any Unicode text including emoji as a Base64 string.

Paste text with emoji or Japanese characters and get a clean Base64 string — skip the "character out of range" error that plain btoa() throws on anything past Latin-1. The tool walks your text through UTF-8 bytes first, so 🌍 and 日本語 come out right on the other side. And everything runs in your browser. Nothing gets uploaded.

FAQ

How does Unicode to Base64 work?

The text is first encoded to UTF-8 bytes using the TextEncoder API. Each byte is then mapped to a Latin-1 character, and btoa() produces the final Base64 string. This ensures all Unicode characters including emoji are safely encoded.

Why not just use btoa() directly?

JavaScript's btoa() only works with Latin-1 characters (code points 0-255). For Unicode text with characters above that range, you must first convert to UTF-8 bytes, which this tool handles automatically.

Is this the same as UTF-8 to Base64?

Functionally yes. Unicode text is first encoded as UTF-8 bytes, then those bytes are Base64-encoded. The result is identical.

Can I decode the result back?

Yes. Use atob() to get the Latin-1 string, convert each character back to a byte, then use TextDecoder to get the original Unicode text.

Related Tools