🔍

首页Home › 编码与加密Encoding & Crypto

📎 文件与 Base64 互转File to Base64 & Back

把任意文件(PDF、Word、压缩包、音视频等)转换成 Base64 字符串或 Data URI,也可以把 Base64 还原成文件下载,自动识别文件类型,全程本地处理不上传。Convert any file (PDF, Word, archives, audio, video…) to a Base64 string or data URI, or turn Base64 back into a downloadable file with automatic type detection — all locally, nothing uploaded.

文件 → Base64File → Base64

点击选择或拖放文件Click or drop a file

Base64 → 文件Base64 → File

使用说明与常见问题How-to & FAQ

「文件与 Base64 互转」是什么?What is the File to Base64 & Back tool?

把任意文件(PDF、Word、压缩包、音视频等)转换成 Base64 字符串或 Data URI,也可以把 Base64 还原成文件下载,自动识别文件类型,全程本地处理不上传。Convert any file (PDF, Word, archives, audio, video…) to a Base64 string or data URI, or turn Base64 back into a downloadable file with automatic type detection — all locally, nothing uploaded.

如何使用「文件与 Base64 互转」?How do I use the File to Base64 & Back?

上半部分:选择或拖放文件,立即得到 Base64,可选择输出 Data URI 或每 76 字符换行(MIME 格式)。下半部分:粘贴 Base64 或 data: 开头的 Data URI,工具会识别文件类型,点击按钮即可下载还原后的文件。Top: pick or drop a file to get its Base64, optionally as a data URI or wrapped at 76 characters (MIME). Bottom: paste Base64 or a data: URI, the file type is detected, and one click downloads the restored file.

Base64 后文件为什么变大了?Why is the Base64 larger than the file?

Base64 用 4 个可打印字符表示 3 个字节,所以体积大约增加三分之一(33%)。它适合在 JSON、HTML、邮件等只能放文本的地方传递二进制文件。Base64 uses 4 printable characters for every 3 bytes, so it is about a third (33%) larger. It is meant for carrying binary data where only text is allowed, such as JSON, HTML or email.

还原时怎么知道原来是什么文件?How is the original file type detected?

如果粘贴的是 data: 开头的 Data URI,会直接使用其中的 MIME 类型;否则根据文件开头的特征字节(如 PDF 的 %PDF、PNG 的 89 50 4E 47)判断,并自动填好扩展名,你也可以手动修改文件名。If you paste a data: URI its MIME type is used; otherwise the type is detected from the leading signature bytes (e.g. %PDF for PDF, 89 50 4E 47 for PNG) and the extension is filled in — you can still rename the file.

「文件与 Base64 互转」免费吗?数据会上传吗?Is the File to Base64 & Back free? Is my data uploaded?

「文件与 Base64 互转」完全免费,无需注册或安装,手机和电脑都能用;所有处理都在你的浏览器本地完成,输入的内容和文件不会上传到服务器。The File to Base64 & Back is completely free with no sign-up or install and works on phones and desktops; everything runs locally in your browser and nothing you enter is uploaded.

相关工具Related tools

🔐 Base64 编码解码Base64 Encode / Decode🧬 图片转 Base64Image to Base64🖼️ Base64 转图片Base64 to Image🧬 Base64 转 UTF-8 文本Convert Base64 to UTF-8🧾 文件哈希校验File Checksum (MD5/SHA-256)🧬 文件真实格式识别(文件头)File Type Detector (Magic Bytes)📎 MIME 类型查询MIME Types Lookup

← 全部工具All tools