Text to Base64

Type or paste any text and get its Base64 representation immediately. The encoder handles Unicode correctly (accents, Cyrillic, Chinese, emoji), unlike a bare btoa() call, which fails on non-Latin characters.

How to convert Text to Base64 online

  1. Paste your text.
  2. Optionally enable Encode each line separately or Convert as I type.
  3. Click Encode text to Base64 and copy the result.

How can I convert a Word or DOC file to Base64?

If you need the text of a document, copy it from Word and paste it here. If you need the file itself (for example to attach it through an API), use the File to Base64 encoder instead, which encodes the binary .docx file.

Frequently asked questions

How do I convert a string to Base64?

Paste the string into the text box and press "Encode text to Base64". The result is identical to base64_encode() in PHP or base64.b64encode() in Python for UTF-8 input.

Why does btoa() throw "InvalidCharacterError"?

btoa() only accepts Latin-1 characters. Text must be converted to UTF-8 bytes first, which this tool does automatically.

Related tools and guides

Comments (0)

Questions, ideas or a bug in “Text to Base64”? Leave a comment, rate the tool, or reply to others.

No comments yet. Be the first to share your feedback!

Leave a comment

Rate this tool:
Esc
↑ ↓ move↵ openEsc close