跳到主要内容
Z

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

常见问题

\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 结果。