Base32 Encode / Decode

One input per line. Output is numbered to match the input order.
Pinned tools are listed in your favourites on the home page.Copies a link to this tool that carries your current input, so it opens ready to run.Gives you an iframe snippet for putting this tool on your own site.
Ctrl+Enter Run  · Ctrl+Shift+C Copy  · Esc Clear

Understand Base32 Encode / Decode

Base32 用 32 个字母和数字对字节编码,这些字符经过挑选,便于人念出来或手工输入而不产生歧义。

How it works

RFC 4648 的字母表是 A–Z 加 2–7。它刻意省略 0、1、8 和 9,因为它们容易与 O、I 和 B 混淆。五个字节(40 位)映射为八个字符,每个字符五位,因此输出比输入大约 60%——明显不如 Base64 的 33%,这就是为换取更小字母表所付的代价。用 = 填充把最后一组补足到八个字符,解码时不区分大小写。

When to use it

  • 读取或生成 TOTP 验证码背后的共享密钥——Google Authenticator、Authy 和 1Password 都以 Base32 交换它。
  • 对需要从屏幕上读出来手工输入、或在电话里口述的值进行编码。
  • 为大小写不敏感的文件系统构造标识符——Base64 的大小写混排在那里会发生冲突。
  • 处理 DNS 标签或洋葱地址,它们大小写不敏感,正因如此才使用 Base32。

Watch out for

  • Base32 不止一种。RFC 4648 base32(A–Z、2–7)、base32hex(0–9、A–V)、Crockford Base32 和 z-base-32 都存在,而且互不兼容——解出来是乱码通常意味着变体选错了,而不是数据损坏。
  • TOTP 密钥是随机字节,不是文本。在这里解码它得到的是不可读的字符,这是预期结果:这些字节就是密钥,本来就不该拼成任何词。
  • 和 Base64 一样,这是编码而非加密。屏幕上的 Base32 验证器密钥,就是明晃晃摆着的有效凭据。

Frequently Asked Questions

什么时候用 Base32 而不是 Base64?

Base32 的长处在于大小写不敏感的场合:TOTP 验证器密钥(Google Authenticator、Authy)、可能被转成大写的二维码、大小写不敏感系统上的文件路径,以及需要人工誊写的校验值——那里 0 与 O、1 与 l 容易出错。

Base32 与 Base64 在体积上有什么差别?

Base32 使数据膨胀约 60%(5 字节 → 8 字符),而 Base64 约为 33%(3 字节 → 4 字符)。更大的开销是使用更小、更无歧义字母表所付的代价。

Base32 的字母表是什么?

RFC 4648 的 Base32 使用 A–Z 和 2–7(共 32 个字符)。它刻意省略 0、1、8 和 9,以免与 O、I/L 混淆。= 用作填充字符。

How to Use Base32 Encode / Decode

  1. Paste or type your input in the input area above.
  2. The tool processes your input automatically or click Run.
  3. Copy or download the result using the action buttons.
  4. Use Ctrl+Enter to run quickly from the keyboard.