Text to Base64
Text to Base64 converts any string to Base64 online: type or paste plain text to Base64, ASCII to Base64, or UTF-8 to Base64 and copy the result. Accented letters, CJK text, and emoji are encoded as UTF-8 first, so the decoded value matches what you typed. No upload is needed; the conversion runs in your browser.
In WeChat, downloads and image copy may be blocked. If a button does not respond, tap ··· in the top-right corner and choose Open in Browser.
Input 0 B · Output 0 B
Text to base64 converts a sentence, a code snippet or a whole paragraph into the ASCII string that APIs and config files expect, reading the text as bytes and encoding it in your browser. The encoded result appears in a read-only box that is ready to copy, and no request carries it anywhere.
Typical jobs are small but frequent: putting a Unicode name into a header that only accepts ASCII, storing a paragraph in a JSON field without escaping quotes, or producing a test value for a login form. A page that reports byte counts is more useful than one that only shows the string, because the counts explain why the output is longer than the sentence. Choosing the charset before you copy is the difference between a value that decodes elsewhere and one that only works here.
How to use
- Type or paste the text. The left box accepts any Unicode text, including emoji, tabs and line breaks. Sample loads a mixed test string, and the output refreshes on every keystroke while Live is checked.
- Choose the charset. Auto and UTF-8 treat the input as UTF-8, which is what modern APIs expect. Picking ASCII, ISO-8859-1, UTF-16 or a CJK encoding changes the bytes first, so the same sentence can produce a different Base64 string.
- Copy the string. Copy output places the text to base64 value on the clipboard, and Download saves it as
encoded.txt. The stats line shows input bytes, output bytes and the percentage change.
Bytes, charsets and the ASCII trap
The encoder never changes the characters you type; it changes how those characters become bytes. That distinction explains almost every surprising result on this page.
From string to base64 in two steps
The encoder first turns the string into bytes, then maps every three bytes onto four Base64 characters. hello is five ASCII bytes and becomes aGVsbG8=, with one = because the last group holds only two bytes. Hi is two bytes and becomes SGk= with two = signs. A 1,000-character ASCII paragraph therefore lands near 1,364 output characters, not 1,000 at all. The output box is read-only, and Copy takes the whole string, so a wrapped display never inserts hidden breaks into the clipboard.
Plain text to base64 keeps every character
Tabs and line breaks are part of the payload. a<TAB>b encodes to YQli, and a trailing newline adds Cg== at the end, so a file that ends with \n and one that does not will encode differently. If a server rejects a value that works in a browser, check whether the editor trimmed a final newline or converted \n to \r\n before encoding. Most editors add a newline at the end of a file, so compare byte counts when two encodings of the same text disagree.
Why ascii to base64 turns letters into question marks
Choosing ASCII does not transliterate. Any character above U+007F is replaced with ? before encoding, so é becomes Pw== instead of the UTF-8 form w6k=. The same happens to Chinese text and emoji, which is why ASCII output can be short but wrong. Use ASCII only when the receiving system provably expects it, and UTF-8 for everything else. Decoding Pw== gives a literal question mark, which is indistinguishable from a question mark that was in the source.
FAQ
How do I do utf-8 to base64?
Leave Charset on Auto or pick UTF-8, paste the text, and read the output. The encoder converts the string to UTF-8 bytes first, so accented letters and emoji keep their meaning. A wrong charset setting is the main reason a decoded value looks corrupted later.
Why does the output differ from another converter?
A text to base64 output can differ because the bytes differ. UTF-16 adds a byte-order mark, ASCII replaces non-ASCII characters with question marks, and line wrapping inserts breaks. Compare the charset option and the padding before assuming one tool is wrong.
Is the text uploaded to a server?
No. The text to base64 step runs in JavaScript in the tab, and the string never leaves your device. There is no account and no request, so the page works for internal notes, customer names and anything else you would not paste into an online form.
Why is the Base64 string longer than the text?
In a text to base64 result, each character carries six bits, so three bytes become four characters. Plain ASCII grows by about a third, while emoji grow more because a single emoji already occupies four UTF-8 bytes before encoding begins.
Can I use the result in JSON or HTML?
Yes. Standard Base64 uses only letters, digits, plus, slash and equals, so it can sit inside a JSON string without escaping quotes. For URLs and tokens, switch on URL-safe mode so plus and slash become hyphen and underscore.
Related tools
Image to Base64 Converter applies the same alphabet to pictures and adds a data URI header, which is what a text to base64 value does not need. Base64 to Image reverses a picture payload and shows a preview. PDF to Base64 Converter handles documents up to 20 MB and offers JSON and XML wrappers. Each page keeps the file or the text local, so nothing is uploaded while you test a value.