Home Text to Base64

Text to Base64

Encode UTF-8 text into a Base64 string — 100% in your browser.

Input

Output

What is Text to Base64?

Text to Base64 is a tool that converts plain text into a Base64 string. Base64 is an encoding scheme that represents binary data using only 64 printable ASCII characters — the uppercase letters A–Z, lowercase letters a–z, digits 0–9, plus the symbols "+" and "/", with "=" used for padding at the end. Because the output uses only safe ASCII characters, Base64 can travel through systems that would otherwise mangle or reject raw binary data.

This tool encodes text using full UTF-8 awareness, which means it correctly handles English text as well as Chinese characters, Japanese kana and kanji, emoji, and other multi-byte characters. Naive use of the built-in btoa() function in JavaScript throws an error on any character outside Latin-1, so this tool first encodes the text to UTF-8 bytes and then to Base64, producing output that is compatible with every standard Base64 decoder.

How Base64 encoding works

Base64 works by taking the input bytes three at a time (24 bits) and splitting them into four groups of 6 bits. Each 6-bit group is then looked up in a 64-character alphabet to produce one output character. Because every output character represents 6 bits of input, the encoded string is roughly 33% longer than the original bytes. If the input length is not a multiple of three, the output is padded with one or two "=" characters so the final length is a multiple of four.

For example, the text "Man" is encoded as "TWFu". Breaking it down: the bytes 77, 97, 110 (binary 01001101 01100001 01101110) are split into 010011, 010110, 000101, 101110, which map to the letters T, W, F, u. Understanding this mechanism helps explain why Base64 output is always a multiple of four characters and why it grows in size.

When to use Text to Base64

Base64 encoding is used in a wide range of practical scenarios. The most common ones include:

  • Embedding binary in JSON or XML. Encode images, fonts or file contents as Base64 so they can be carried inside a text-based format without escaping issues.
  • Data URIs in HTML and CSS. Inline small images or icons directly in stylesheets or <img src="data:..."> tags to reduce HTTP requests.
  • Email attachments (MIME). Base64 is the standard encoding for binary attachments in email messages, which were originally designed for ASCII text only.
  • HTTP Basic Authentication. Username and password are sent as a Base64-encoded Authorization header (note: this is encoding, not encryption).
  • Storing complex data in URLs or cookies. Encode structured text so it survives transport through systems that interpret special characters.
  • JWT tokens. The header and payload of a JSON Web Token are Base64URL-encoded before signing.

Whenever you need to move text or binary data through a channel that only safely handles ASCII, Base64 is the default choice — and this tool gives you a correct, UTF-8-safe encoding instantly.

How to convert text to Base64

Encoding text to Base64 with this tool takes a second and happens entirely in your browser. No upload, no sign-up, no installation. Follow these three steps:

  1. Paste your text. Click inside the input box on the left and paste or type the text you want to encode — English, Chinese, Japanese, emoji or a mix are all supported.
  2. Click "Encode". The Base64 string appears in the output box on the right, along with a small notice showing the input and output lengths.
  3. Copy or download. Click "Copy" to copy the result to your clipboard, or "Download .txt" to save it as a text file. Click "Clear" to start over.

Because the encoding is computed locally with JavaScript on your own device, your text never leaves your browser. This makes the tool suitable for confidential strings such as tokens, credentials fragments, or unpublished content.

Tips for working with Base64

Base64 is an encoding, not encryption — anyone can decode a Base64 string back to the original text. Never treat Base64 as a way to protect sensitive data; use it only for transport or formatting. If you need confidentiality, combine Base64 with a real encryption layer such as AES.

Watch out for the Base64URL variant, which replaces "+" with "-" and "/" with "_" and typically drops the "=" padding. It is used in JWTs and URL-safe contexts. If you paste a Base64URL string into a standard decoder, you may need to convert those characters back first. Finally, remember that Base64 increases size by about 33%, so it is not a good choice when you need to minimise payload size — use a real compression tool instead.

Is this Text to Base64 tool free?

Yes, completely free with no sign-up, no watermarks and no limits beyond your device's memory.

Does it support Chinese, Japanese and emoji?

Yes. The tool first encodes the text to UTF-8 bytes and then to Base64, so Chinese characters, Japanese kana and kanji, emoji and any other Unicode characters are encoded correctly and are fully reversible.

Is Base64 the same as encryption?

No. Base64 is an encoding scheme — it is trivial to decode. Never use it to protect secrets. Use it for transport and formatting only, and combine it with a real encryption algorithm if confidentiality is required.

Is my text uploaded?

No. All encoding is local. Your text never leaves your browser, so it is safe to paste confidential strings.

Can I decode Base64 back to text?

Yes. Use the companion Base64 to Text tool to decode a Base64 string back to the original UTF-8 text.