Base64 Encode & Decode — Text, Image, URL

Runs entirely in your browser. Nothing is uploaded, so you can paste client data, tokens or keys without it leaving your machine. 全程本地运行,不上传任何内容。

UTF-8 safe: emoji and Chinese characters encode correctly, not as broken bytes.

如果是二进制内容(图片、压缩包),这里会给出十六进制预览,而不是乱码。

超过 100 KB 的图片转成 data URI 后会让 HTML 变得很重,网页里通常更该直接用图片文件。这里主要是给你做邮件签名、内嵌小图标、或者给 API 传图用。

用 encodeURIComponent,会把空格变成 %20、中文变百分号编码——放进 URL 参数才不会断。

[ 广告/联盟位 —— 待填 ]

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 haveWhat 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),再试一次。

[ 广告/联盟位 —— 待填 ]