What Base64 actually does 原理
Base64 doesn't encrypt anything. It takes every 3 bytes (24 bits) and re-splits them into 4 characters of 6 bits each, using A–Z a–z 0–9 + /. The = at the end is padding, not data. So the output is about 33% larger than the input and can be read back by anyone — treat it as an encoding, never as protection.
因为只是编码不是加密,所以永远不要用 Base64 去“保护”密码、身份证号或者 API key——它一眼就能解开。
Common cases 常见场景
| What you have | What to do |
|---|---|
| Windows 记事本存的 CSV 打开是乱码 | 那不是 Base64 问题,是编码/BOM 问题 —— 见 CSV UTF-8 与 BOM |
API 返回 {"content":"SGVsbG8="} | 用 Decode 页签,粘贴字符串(带不带 = 都行) |
| JWT token 中间那段看不懂 | 那是 base64url(- _ 代替 + /),Decode 页签直接支持 |
| 邮件里要内嵌小图标 | Image 页签 → 转 data URI |
| URL 里的中文变成乱码 | URL 页签 → Encode URI |
Frequently asked 常见问题
Is Base64 safe to use for passwords?
No. It's reversible by anyone with the string. Use it to move bytes through text-only channels, and use hashing (bcrypt/argon2) or real encryption for secrets.
Why does my decoded text look like gibberish?
The bytes probably aren't UTF-8 text — could be an image, a zip, or Latin-1 data. This tool falls back to a hex preview instead of printing broken characters.
Why is the output longer than the input?
Every 3 bytes become 4 characters, then padding is added. Expect roughly 33% growth, plus line breaks if whatever produced it wrapped lines.
Do you store what I paste?
No. There's no backend — the page is a single HTML file and all conversion happens in your browser's JavaScript. You can even save it and use it offline.
What's the difference between Base64 and Base64URL?
Base64URL swaps + for - and / for _ so the string can sit inside a URL or filename. This decoder accepts both.
为什么解码后中文是乱码?
原字符串不是按 UTF-8 编码的,或者被截断了。先确认它来自哪里(多数 API 用 UTF-8),再试一次。