Skip to content
ByteMath

How do I Base64-encode text with special characters?

Encode any text to Base64 with correct UTF-8 handling, including accents and emoji. Output is about 33 % larger than the input. Runs locally.

Last updated:

Inputs

Output

SGVsbG8sIFdvcmxkISBHcsO8w59lIGZyb20gWsO8cmljaCDigJMg8J+YgA==
Input size
43 B
Output size
60 B
Records
–
Output vs input
140 %

Results are engineering estimates for planning. Final designs must follow your local code and be checked by a qualified professional.

This scenario at a glance

Input
ConversionText → Base64
CSV delimiterComma (,)
InputHello, World! Grüße from Zürich – 😀
Calculated
OutputSGVsbG8sIFdvcmxkISBHcsO8w59lIGZyb20gWsO8cmljaCDigJMg8J+YgA==
Input size43 B
Output size60 B
Records–
Output vs input140 %

Engineering notes for this workload

Base64 turns arbitrary bytes into a string of 64 safe ASCII characters, so binary data or text with special characters can travel through systems that only handle plain text: email bodies (MIME), data URLs, JSON fields, HTTP Basic authentication headers and configuration files.

The encoding works on bytes, not characters, which is where many quick implementations fail. JavaScript's built-in btoa function throws an error for characters outside Latin-1, such as the euro sign or emoji. This tool first encodes the text as UTF-8 bytes and then Base64-encodes those bytes, so "Grüße", "Zürich", the en dash and the emoji in the sample all round-trip correctly. Decoding on the other side must also use UTF-8.

Size overhead is predictable: every 3 bytes become 4 characters, so the output is about 33 % larger, plus up to two = padding characters. In the calculator, compare the input and output byte counts; the ratio sits around 133 %. That overhead is why Base64 is a poor choice for large files in JSON APIs; multipart uploads or binary transfer are more efficient.

Base64 is an encoding, not encryption. Anyone can decode it instantly. Never use Base64 to hide passwords, API keys or personal data. HTTP Basic authentication sends credentials Base64-encoded, which is only safe over HTTPS.

For URLs and JSON Web Tokens, the URL-safe variant (Base64url, RFC 4648 section 5) replaces + and / with - and _ and usually omits padding. The decoder on this site accepts both variants.

Everything runs locally in your browser; the text you encode is never sent to a server.

Data URLs are a common use: data:image/svg+xml;base64, followed by the encoded file embeds small icons directly in HTML or CSS, saving a request. For anything larger than a few kilobytes, a separate cached file is usually faster because Base64 data cannot be cached independently and inflates the HTML or CSS that contains it.

Reference table

Data format reference
FormatStandardKey rules
CSVRFC 4180Fields with delimiter, quote or newline are quoted; quotes doubled ("")
CSV (Excel DE/FR/ES)Locale defaultSemicolon delimiter because comma is the decimal separator
JSONRFC 8259UTF-8, double-quoted keys and strings, no trailing commas, no comments
Base64RFC 4648 §4A–Z a–z 0–9 + /, = padding, 4 characters per 3 bytes (+33 %)
Base64urlRFC 4648 §5- and _ instead of + and /, padding often omitted (JWT)

All conversions on this site run locally in your browser.

Questions about this scenario

How do I Base64-encode UTF-8 text?

Encode the text to UTF-8 bytes first, then Base64-encode the bytes. This tool does both steps.

Why is Base64 output bigger than the input?

Every 3 bytes become 4 characters, so Base64 adds about 33 % plus padding.

Is Base64 encryption?

No. It is a reversible encoding that anyone can decode; use real encryption to protect data.