Guide
Base32 and why authenticator apps use it
By Logappradeep · ServiceNow developer
Base32 represents binary data using 32 characters: the uppercase letters A–Z and the digits 2–7. Compared with Base64 it is less compact, but it has properties that make it ideal whenever humans have to read, type, or say the encoded value, or when the value must survive systems that ignore letter case.
How the encoding works
Each Base32 character carries 5 bits. The encoder groups input into blocks of five bytes (40 bits) and emits eight characters per block. The word hello is exactly five bytes, so it encodes neatly to NBSWY3DP with no padding. Shorter final blocks are padded with = to a multiple of eight characters in the canonical RFC 4648 form, though many applications omit it. This encoder always adds the padding, and the decoder accepts input with or without it. Because eight characters represent five bytes, output is about 60% larger than the input, compared with roughly 33% for Base64. Text is converted to UTF-8 bytes first, so any character can be encoded.
Why choose Base32 over Base64
- Case-insensitive. Only one letter case is used, so values survive case-insensitive file systems, DNS names, and people who type in lowercase.
- Fewer look-alike characters. The digits 0, 1, 8, and 9 are left out, so 0 cannot be confused with O, 1 with I or l, or 8 with B.
- No punctuation. Without
+,/, or=in the body, values are safe in URLs, file names, and identifiers.
Where it is used
- Two-factor authentication. TOTP and HOTP secrets in authenticator apps are shared as Base32, both in the text you can type manually and inside
otpauth://QR codes. - Tor onion addresses, which are Base32 encodings of a public key and checksum.
- Content identifiers such as IPFS CIDv1, which commonly use a lowercase Base32 form.
- Human-friendly codes like license keys and recovery codes.
Pitfalls
- Several incompatible variants exist. RFC 4648 also defines base32hex (digits 0–9 then A–V), and Crockford's Base32 and z-base-32 use different alphabets again. Decoding data from one variant with another produces garbage without any error.
- Grouped display. Authenticator setup screens often show secrets in groups of four separated by spaces. This decoder ignores the spaces, but other tools may need them removed.
- Missing padding. Strict decoders may require the trailing
=characters that many systems leave off. - Not a security measure. A Base32-encoded TOTP secret is the secret itself; anyone who sees it can generate your codes.
Encoding and decoding run locally in your browser, which matters here: 2FA secrets should never be pasted into a tool that sends them to a server.