Base64 编解码
UpBox优盒工具箱,免费 Base64 编码解码工具,支持中文与 URL-safe,数据本地处理,不上传内容。
无需注册 · 数据不上传No sign-up · nothing uploaded
输入内容Input
输出结果Output
选择编码或解码,结果会显示在右侧
本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器
工具介绍
Base64 把任意文本或二进制内容编码成可安全放进 URL、JSON、邮件头的字符集。这里用 UTF-8 处理中文与表情,编码结果不会出现乱码。 Base64 turns arbitrary text or binary data into characters that survive URLs, JSON and mail headers. This tool works in UTF-8, so Chinese text and emoji survive round trips.
需要放进文件名或查询参数时,勾选 URL-safe,会把 + 和 / 换成 - 与 _,并去掉结尾的等号;解码时两种变体都能自动识别。 Tick URL-safe for filenames or query strings: + and / become - and _, and trailing padding is dropped. Decoding recognises both variants.
- UTF-8 安全,中文不乱码UTF-8 safe, Chinese text intact
- URL-safe 变体一键切换One-click URL-safe variant
- 自动识别缺失的 paddingRecognises missing padding
- 结果可复制或下载Copy or download the result
使用说明
- 把要处理的文本粘贴到左侧输入框。Paste the text into the left editor.
- 点“编码”或“解码”;放进 URL 前先勾选 URL-safe。Choose Encode or Decode; tick URL-safe before putting it into a URL.
- 解码失败时会直接提示不是合法的 Base64,而不是返回空白。A failed decode says it is not valid Base64 instead of returning blank output.
- 点“交换”可以把结果送回输入框,方便反向验证。Swap sends the result back into the input to verify the round trip.
常见问题
为什么中文需要 UTF-8?Why does Chinese need UTF-8?
浏览器的 btoa 只接受 Latin-1 字符。这里先把文本转成 UTF-8 字节再编码,所以中文、表情都能正确往返。btoa only accepts Latin-1. This tool converts text to UTF-8 bytes first, so Chinese and emoji round-trip correctly.
URL-safe 有什么区别?What is different in URL-safe?
标准 Base64 的 + / = 在 URL 里有特殊含义,URL-safe 变体把它们换成 - _ 并去掉填充,可安全放进路径与参数。Standard Base64 uses + / = which are special in URLs; the URL-safe variant maps them to - _ and drops padding.
内容会上传吗?Is anything uploaded?
不会,编码解码都在当前页面内完成,刷新即清空。No. Encoding and decoding happen in this page and are cleared on refresh.