TOP

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.

No signupRuns locally in your browser

Interactive tool

Convert Text to Base64

Ready

Output format

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.

InputOutputMeaning
你好5L2g5aW9Six UTF-8 bytes
HelloSGVsbG8=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

Choose the conversion that matches the representation you have.

Advertisement

Sponsored link