Encode text to Base64
Turn any text—including Chinese and emoji—into Base64 using UTF-8. Optional URL-safe mode replaces +/ with -_ for links and tokens.
Private · Fast · Free
Base64 turns bytes into a text-safe alphabet so you can embed data in JSON, email, or configs. This page encodes UTF-8, so non-English text stays correct.
For images as data URLs, use Image to Base64 instead — this tool is for plain text only.
JWT and some OAuth tokens use URL-safe Base64 without padding; match that mode here when encoding or decoding.
How to encode text to Base64
- Paste any text (Unicode, emoji, or code snippets)
- Enable URL-safe Base64 if the result goes in a URL or token
- Convert and copy — everything stays in your browser
Why use this encoder
- UTF-8 by default for multilingual text and emoji
- Optional URL-safe alphabet (-/_) with padding stripped
- Runs locally — nothing is uploaded
- Examples and FAQ written for real failure cases
Common uses
- Encode short secrets or config snippets for tickets
- Build URL-safe state or signature fragments
- Spot-check API Base64 fields before shipping
- Pair with JWT decoder and URL encode
Tips
- Trailing = is padding; some systems omit it — decoding accepts both
- Output is ~33% larger than the UTF-8 byte length
- Need the reverse? Use Base64 to text
Examples
| Input | Output | Note |
|---|---|---|
| Hi | SGk= | ASCII / Latin |
| 你好 | 5L2g5aW9 | Chinese with UTF-8 |
| 🎉 | 8J+OiQ== | Emoji |
| a+b/c= | YStiL2M9 | Try URL-safe when +/= matter |
FAQ
- How do I encode Chinese text to Base64?
- Paste the text, keep UTF-8 (default), and convert. Each character becomes the correct UTF-8 bytes before Base64 encoding.
- When should I use URL-safe Base64?
- When the result goes into a URL, filename, or token where + and / can break. Enable URL-safe to use - and _ instead, and padding may be omitted.
- Why is there an equals sign at the end?
- Padding (=) fills the last block to a multiple of 4 characters. Some systems omit it; decoding here still works either way.
- How is this different from Image to Base64?
- This page encodes plain text only. To embed a whole image in HTML/CSS, use the Image to Base64 tool.