Base32 Encode & Decode

Convert text to Base32 and back with the standard RFC 4648 alphabet or the base32hex, Crockford and z-base-32 variants. The decoder is forgiving about case, white space and missing padding.

Loading tool…

About the Base32 Encode/Decode

Base32 (RFC 4648) writes binary data with 32 characters, 5 bits per character: A–Z and 2–7. Every 5 bytes become 8 characters, and a shorter last group is completed with = padding, so foobar encodes to MZXW6YTBOI======. The output is 60% larger than the input — more than Base64 — but it has a single letter case and no symbols, which makes it safe in file names, DNS labels and anything a person has to read aloud or type. TOTP secrets for authenticator apps are the best-known use.

Four alphabets are supported. base32hex uses 0–9 and A–V, so encoded values sort in the same order as the bytes (it is used by DNSSEC NSEC3). Crockford drops I, L, O and U to avoid confusion and accidental words, and is the alphabet of ULIDs; when decoding, O is read as 0, I and L as 1, and hyphens are ignored. z-base-32 reorders a lower-case alphabet so that the most frequent characters are the easiest to read. Crockford and z-base-32 have no padding.

Text is converted to UTF-8 bytes before encoding, so accents, CJK and emoji survive the round trip. The decoder accepts upper and lower case, skips spaces and line breaks, and does not need the padding. It reports the exact character and position of anything that is not in the alphabet, and lengths that cannot occur (a last group of 1, 3 or 6 characters), which point to truncated input. Decoded bytes that are not UTF-8 text, such as a TOTP secret, are shown in hexadecimal.

How to use it

  1. Choose Encode or Decode.
  2. Pick the alphabet: standard, base32hex, Crockford or z-base-32.
  3. Type or paste your text; untick Padding if your target wants none.
  4. Copy the result, or use ⇄ Swap to reverse the conversion.

Frequently asked questions

Why use Base32 instead of Base64?
Base32 is case-insensitive and has no +, / or mixed case, so it survives case-folding systems, DNS names and manual typing. The price is size: 8 characters for 5 bytes against 4 characters for 3 bytes.
My authenticator secret decodes to unreadable characters. Is it wrong?
No. A TOTP secret is random bytes, not text. The tool shows the bytes in hexadecimal when they are not valid UTF-8; that hex value is the actual key.
What does “impossible length” mean?
A Base32 text can only end after 2, 4, 5, 7 or 8 characters of a group, because only those hold a whole number of bytes. A last group of 1, 3 or 6 characters means characters are missing.
Is the padding required?
RFC 4648 asks for it, but many systems (TOTP URIs, Crockford, z-base-32) leave it out. The decoder accepts both; the encoder lets you choose.

Related tools