Base64 text encoder

Encode UTF-8 text to Base64 or decode it.

  • Runs locally
  • Free

Use the tool

Your files are processed in your browser and are not uploaded to a server.

About this tool

Encode UTF-8 text to Base64 or decode standard Base64 back to text, including non-Latin characters and emoji. Common for API debugging, config values and simple data transfer.

Typical uses

  • Decode a Base64 string from an API response
  • Encode a config value containing non-ASCII text
  • Read Base64 content in email or logs

How to use

  1. Enter UTF-8 text or a standard Base64 string.

  2. Encode or decode, then copy or download the result.

Good to know

This handles text, not binary files. Input is limited to one million characters.

From text to Base64: UTF-8 bytes first

When you press “Encode”, the tool turns the text into UTF-8 bytes, then writes every 3 bytes as 4 characters from the standard RFC 4648 alphabet (A–Z, a–z, 0–9, + and /), padding a short final group with =. The table was produced by the tool’s own encoder:

TextUTF-16 lengthUTF-8 bytesBase64
"Doc80"55: 44 6F 63 38 30RG9jODA=
"你好"26: E4 BD A0 E5 A5 BD5L2g5aW9
"東京タワー"515: E6 9D B1 E4 BA AC E3 82 BF E3 83 AF E3 83 BC5p2x5Lqs44K/44Ov44O8
"café"45: 63 61 66 C3 A9Y2Fmw6k=
"Mañana"67: 4D 61 C3 B1 61 6E 61TWHDsWFuYQ==
"😀"24: F0 9F 98 808J+YgA==
"???"33: 3F 3F 3FPz8/
"a↵b"33: 61 0A 62YQpi
  • Accented letters need two bytes in UTF-8, so “café” is 5 bytes and “Mañana” is 7. A system that uses Windows-1252 or Latin-1 would produce a different Base64 string for the same word, and the decoder must use the same encoding. This tool always uses UTF-8.
  • The emoji “😀” is 4 bytes and ends with two = signs. It counts as 2 characters (UTF-16 units) in the input, which is also how the one-million-character limit is measured.
  • Output is always a single line with no line breaks, and padding is always included. RFC 4648 section 3.1 says implementations must not add line feeds unless the referring specification asks for them; MIME e-mail limits lines to 76 characters, so wrap the result yourself if you need that format.
  • Line breaks in a browser text box are always LF (the HTML standard normalises a textarea’s value to LF). Typing “a↵b” therefore gives YQpi; the same content saved with Windows CRLF line endings encodes to YQ0KYg==, so the two strings cannot be compared directly.

One third bigger: the exact numbers

Base64 length = 4 × ⌈bytes ÷ 3⌉. Small inputs grow by more, and large ones approach 4/3 (about 1.333):

BytesBase64 charactersPaddingRatio
14==4
24=2
34—1.333
48==2
58=1.6
68—1.333
100136==1.36
  • Both directions accept at most 1,000,000 input characters; beyond that you see “Input is limited to 1 million characters.”
  • At the limit, one million ASCII characters encode to 1,333,336 Base64 characters, and one million Chinese characters (3,000,000 bytes) to 4,000,000.
  • In the other direction, one million Base64 characters decode to at most 750,000 bytes. A long text you encoded here can therefore produce a result that is too long to paste back for decoding.
  • Base64 is not encryption. RFC 4648 section 12 states that base encoding provides no confidentiality: anyone can reverse it. Passwords and personal data need real encryption.

What decoding accepts and rejects

“Decode” first deletes every whitespace character (line breaks, tabs, even the ideographic space U+3000), hands the rest to the browser’s atob, and finally decodes the bytes as strict UTF-8. These are the tool’s actual results:

Input (↵ = line break)ResultWhy
5L2g↵5aW9"你好"Whitespace and line breaks are removed, so MIME Base64 wrapped at 76 characters decodes as is
5L2g[U+3000]5aW9"你好"The ideographic space is removed too
QQ"A"Missing = padding is accepted
QQ=Base64 errorWhen the length is not a multiple of 4, a trailing = is not stripped, so it is invalid
QR=="A"Unused trailing bits are ignored: QQ== and QR== both give A
QQ==QQ==Base64 error= may only appear at the end, so two concatenated Base64 strings fail
Pz8_Base64 errorThe URL-safe characters - and _ are not accepted
Pz8/"???"Swap _ back to / and - back to + and it decodes
77u/5L2g5aW9"你好"A leading UTF-8 byte order mark (EF BB BF) is dropped
5L2g5aWUTF-8 errorThe string was cut off; the last Chinese character has only 2 of its 3 bytes
5L2g5Base64 errorA character count that leaves remainder 1 when divided by 4 can never be valid Base64
iVBORw0KGgo=UTF-8 errorThis is a PNG file signature: binary data, not UTF-8 text
  • On an error the page shows “Input is not valid Base64 or UTF-8 text.”. The same message covers both an invalid Base64 string and decoded bytes that are not valid UTF-8; the table above shows which inputs cause which.
  • The URL-safe variant (base64url, RFC 4648 section 5) replaces + with - and / with _. It is used in JWTs and URL parameters. Swap the two characters back before decoding; missing = signs do not need to be added.
  • Base64 for images, PDFs and other binary files cannot be decoded here because the result is not text; the tool handles text only.

Sources

Frequently asked questions

Can it encode images or files?

This tool handles text. Use the image Base64 converter for images.

Is Base64 encryption?

No. It is only an encoding that anyone can decode; do not use it to protect secrets.

Input limit?

Up to 1 million characters.