What is Base64?
Base64 is a binary-to-text encoding that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, + and /). It lets binary content like images or files travel safely through text-only systems such as JSON, email and data URIs, at the cost of being about 33% larger.
Base64 takes three bytes (24 bits) of input and encodes them as four 6-bit characters, padding with = when needed. It is encoding, not encryption — anyone can decode it, so it provides no security.
Common uses: embedding images in HTML/CSS (data URIs), attaching files in email (MIME), and carrying binary payloads inside JSON or URLs (with a URL-safe variant).
Base64 tools
Base64 编码/解码工具
对文本或文件进行 Base64 编码与解码,支持标准与 URL-safe 变体。完全免费,无需注册。
打开工具Base-N 编码解码器
在浏览器中直接编码和解码 Base16、Base32(RFC 4648)、Crockford Base32、Base85(ASCII85)和 Base91。
打开工具URL 编码/解码工具
对 URL 及其查询字符串参数进行编码或解码。Percent-encoding 可确保数据在传输过程中安全无误。
打开工具UTF-8 转换器
将文本转换为 UTF-8 十六进制字节、十进制字节、\xAB 转义序列或 \u{HEX} 转义序列——反之亦然。
打开工具常见问题
\xAB 和 \u{HEX} 有什么区别?
\xAB 表示一个 UTF-8 字节——多字节字符会展开成多个转义序列。\u{HEX} 表示一个 Unicode 码点——无论 UTF-8 编码长度是多少,每个字符只需一个转义序列。JS 的模板字符串能够识别 \u{...} 语法。
为什么 emoji 会占用 4 个字节?
很多 emoji 的码点超过 U+FFFF,因此需要 4 个字节的 UTF-8 编码。使用码点转义格式(\u{1F680})可以将其显示为单个逻辑字符。
这个工具能解码混合格式吗?
不能——输入内容必须全部是 hex、全部是 decimal、全部是 \xAB,或全部是 \u{},这样才能确保格式识别不出错。请将混合的输入内容拆分开,分别处理。
只是想做 Base64 编码?
请使用我们的 Base64 编码/解码工具——输入文本或文件,即可获得 Base64 结果。