Free exact browser converter
Text to Base64 Converter
Encode text, emoji, and non-Latin characters as UTF-8 Base64. Choose padded Base64 or unpadded Base64url without uploading your text.
Interactive tool
Convert Text to Base64
Ready
Choose a clear output representation.
Detailed conversion guide
How to Convert Text to Base64
The encoder converts the visible text to UTF-8 bytes, then Base64-encodes those bytes. Using UTF-8 first supports accents, non-Latin scripts and emoji that btoa cannot take as a JavaScript string.
Use padded Base64 for interfaces that require the standard alphabet. Select unpadded Base64url for interfaces that explicitly expect the URL-safe alphabet. Confirm the destination format before copying.
| Input | Output | Meaning |
|---|---|---|
你好 | 5L2g5aW9 | Six UTF-8 bytes |
Hello | SGVsbG8= | Five ASCII bytes |
😀 | 8J+YgA== | Four UTF-8 bytes |
Encode UTF-8 Text as Base64 in JavaScript
Encode the bytes from TextEncoder, rather than sending Unicode characters directly to btoa.
const utf8 = new TextEncoder().encode(input);
const raw = Array.from(utf8, b => String.fromCharCode(b)).join("");
const encoded = btoa(raw);Whitespace, Files, and Reversibility
The browser textarea normalizes line endings to LF. The encoder keeps the text as displayed, including spaces, and rejects lone UTF-16 surrogates rather than silently changing them.
Base64 is reversible and offers no confidentiality. If you need to preserve exact file bytes, including CRLF or a BOM, import the file into Binary to Base64 instead.
Related converters
Continue with exact representation converters
Choose the conversion that matches the representation you have.