Base64 编解码Base64 Encoder/Decoder
Base64编码与解码,支持文本和文件Base64 encode and decode, supports text and files.
关于 Base64 编解码About Base64 Encoder/Decoder
Base64 把二进制数据编码为 64 种可打印字符,常用于在 JSON、URL、邮件等“纯文本通道”中安全传输二进制内容。本工具支持文本与文件的 Base64 编码、解码,正确处理中文与 Emoji 等 UTF-8 字符,实时互转、一键复制。Base64 encodes binary data into 64 printable characters, letting binary content travel safely through text-only channels such as JSON, URLs and email. This tool encodes and decodes Base64 for text and files, correctly handling UTF-8 characters like Chinese and Emoji, with instant conversion and one-click copy.
使用方法How to Use
- 在输入框填写文本,或直接选择文件。Type text into the input box, or choose a file.
- 点击「编码」得到 Base64 字符串;点击「解码」将 Base64 还原为原文。Click "Encode" to get a Base64 string, or "Decode" to restore the original.
- 含中文或 Emoji 的文本会按 UTF-8 正确处理,避免乱码。Text with Chinese or Emoji is handled as UTF-8 to avoid mojibake.
- 复制结果用于 Data URL、接口参数或配置文件。Copy the result for Data URLs, API parameters or config files.
常见问题FAQ
Base64 是加密吗?Is Base64 encryption?
不是。它只是一种编码方式,任何人都能无条件解码,绝不能用来保护敏感信息;需要保密请使用真正的加密算法。No. It is merely an encoding that anyone can decode unconditionally — never use it to protect sensitive data; use real encryption for secrecy.
为什么编码后体积变大了?Why does the encoded data get larger?
Base64 用 4 个字符表示 3 个字节,体积约增大 1/3。这是“把二进制当文本传输”所付出的代价。Base64 represents 3 bytes with 4 characters, inflating size by about a third — the price of carrying binary through text channels.
解码出来是乱码怎么办?What if decoding shows garbled text?
通常原内容是二进制(如图片)或使用了非 UTF-8 编码。二进制内容应解码为文件下载查看,而不是按文本展示。The original is usually binary (e.g. an image) or in a non-UTF-8 encoding. Binary content should be decoded to a file rather than displayed as text.
Base64 编码有保密作用吗?Does Base64 encoding provide secrecy?
没有。Base64 是编码不是加密,任何人都可以解码还原。需要保密应使用 AES 等加密算法;可配合本站密码生成器生成强密钥。No. Base64 is encoding, not encryption — anyone can decode it back. For confidentiality, use an encryption algorithm like AES; pair it with the password generator for strong keys.
为什么解码中文会乱码?Why does decoding Chinese produce mojibake?
乱码通常是因为解码后没有按 UTF-8 解释字节序列。本工具默认按 UTF-8 处理中文与 Emoji;从其他平台复制内容时请先确认原始编码方式。Mojibake usually means the bytes were not interpreted as UTF-8 after decoding. This tool defaults to UTF-8 for Chinese and Emoji; when copying from other platforms, confirm the original encoding first.
相关阅读Related Reading
MD5/SHA1/SHA256 怎么选:哈希碰撞、加盐与密码存储的正确姿势Choosing Between MD5, SHA1 and SHA256: Collisions, Salting and the Right Way to Store Passwords
哈希不是加密,MD5 也不是"过时了就不能用"——算法选型取决于场景。本文从碰撞攻击的真实数据出发,讲清通用哈希与密码哈希的本质区别,以及加盐、bcrypt、Argon2 各自的适用边界Hashing is not encryption, and MD5 is not "obsolete so never use it" — algorithm choice depends on the scenario. Starting from real collision-attack data, this article explains the fundamental difference between general-purpose hashes and password hashes, and where salting, bcrypt and Argon2 each fit.
Unicode 与中文:为什么 \u4e2d 是"中",以及 Emoji 代理对的长度坑Unicode and Chinese: Why \u4e2d Means "中", and the Emoji Surrogate Pair Length Trap
从 `\u4e2d` 到"中"只差一次码点查表,但 Emoji 一出现,`string.length` 就开始撒谎。本文讲清码点、编码单元与代理对的关系,以及我在前后端联调中踩过的三个真实坑From `\u4e2d` to "中" is just one code-point lookup, but the moment Emoji enters the picture, `string.length` starts lying. This article explains code points, code units and surrogate pairs, plus three real bugs I hit during frontend-backend integration.
相关工具Related Tools
URL 编解码URL Encoder/Decoder
URL编码与解码,处理特殊字符URL encode and decode, handle special characters.
Unicode 中文互转Unicode Converter
Unicode编码与中文字符互相转换Convert between Unicode escapes and Chinese characters.
HTML 实体编解码HTML Entity Encoder
HTML实体编码与解码HTML entity encoding and decoding.
进制转换Number Base Converter
二进制、八进制、十进制、十六进制互转Convert between binary, octal, decimal and hexadecimal.