Base32 Encoder/Decoder
Encode text to Base32 and decode it back
Working…
0.0
It hasn't frozen — the result will appear when the calculation finishes.
About Base32 Encoder/Decoder
Base32 writes bytes using 32 characters: the uppercase letters A–Z and the digits 2–7 (RFC 4648, section 6). Its output is longer than Base64's, but it is case-insensitive and skips the easily confused digits 0, 1, 8 and 9, which makes it the usual choice for values humans read and type. The best-known example is the “setup key” shown by two-factor authenticator apps.
This tool converts your text to UTF-8 bytes, encodes them with the standard RFC 4648 alphabet, and pads the result with = to a multiple of eight characters. When decoding it accepts lowercase and ignores whitespace and trailing padding.
Why five bytes become eight characters
32 = 2⁵, so each character carries 5 bits. The smallest bit count that is a multiple of both 8 and 5 is 40, so Base32 processes 5 bytes at a time and emits 8 characters. Output size is ceil(n/5) × 8 — 1.6 times the input, or +60%. Base64 on the same data costs +33%, so Base32 is noticeably longer.
When the final block has fewer than 5 bytes, the leftover bits are zero-filled into characters and the rest of the 8-character block is filled with =. With 1, 2, 3 or 4 leftover bytes you get 6, 4, 3 or 1 padding characters. That's why the RFC 4648 test vector “foobar” ends in six = signs: MZXW6YTBOI====== (6 bytes = one full block + 1 byte).
What Base32 is good for
Base64 is case-sensitive and mixes in +, / and =, which makes it painful to read over the phone or copy from paper. Standard Base32 uses only capitals and 2–7; with no 0, 1, 8 or 9, there's nothing to mistake for O, I or B. Case-insensitivity means a user typing in lowercase gets the same value.
Authenticator apps (Google Authenticator and friends) receive their secret through an otpauth:// URI, and the secret parameter is Base32. When you can't scan the QR code, the string you're asked to type — something like JBSWY3DPEHPK3PXP — is that Base32 secret. The app decodes it to bytes and uses them as the HMAC key for the TOTP algorithm (RFC 6238). Decoding a setup key here therefore usually gives unreadable characters: the underlying bytes are random, not text.
Tor v3 onion addresses are another place you'll see Base32: the 56-character name is a Base32 encoding of the service's public key plus a checksum and version byte, written in lowercase.
Base32 is not one format
RFC 4648 also defines “base32hex”, which uses 0–9 and A–V. Its advantage is that encoded strings sort in the same order as the original bytes, which is why DNSSEC NSEC3 records use it. There are also popular non-RFC variants such as Crockford's Base32 and z-base-32. Different alphabets decode the same string into completely different bytes. If this tool reports an invalid character — a 0, 1, 8 or 9 in the input is the typical sign — you are probably looking at base32hex or another variant, which this tool doesn't support.
Worked examples
The RFC 4648 test vectors
- Input
f / fo / foo / foob / fooba / foobar- Output
MY====== / MZXQ==== / MZXW6=== / MZXW6YQ= / MZXW6YTB / MZXW6YTBOI======
Padding shrinks 6 → 4 → 3 → 1 as the last block fills, and disappears at exactly 5 bytes. These match section 10 of the RFC.
Where that sample 2FA key comes from
- Input
Hello- Output
JBSWY3DP
Many TOTP library docs use a sample secret starting with JBSWY3DP. It's just “Hello” in Base32.
Non-ASCII input
- Input
Grüße- Output
I5ZMHPGDT5SQ====
ü and ß are 2 bytes each in UTF-8, so 5 characters become 7 bytes: one full block plus 2 bytes, giving 8 + 8 characters with 4 padding.
Case doesn't matter, digits do
- Input
nbswy3dp (decode)- Output
hello
Lowercase decodes the same as NBSWY3DP. But NBSWY3D0, with a zero, fails: 0 isn't in the alphabet.
How to use it
- Paste text to encode, or a Base32 string to decode.
- The result appears immediately; the swap button reverses the direction.
- If you get an error, look for 0, 1, 8, 9 or symbols — they suggest a different Base32 variant.
Frequently asked questions
Why does my authenticator setup key decode to garbage?
Because it's random bytes, not text. The tool displays decoded bytes as UTF-8 text, so non-text bytes show up as replacement characters. The key is still valid.
Should I use Base32 or Base64?
For machine-to-machine data, Base64 is shorter. For values people type, read aloud, or store in case-insensitive systems like DNS names or some filesystems, Base32 is the better fit.
Can the = padding be omitted?
Yes for this tool — it decodes with or without it. Authenticator setup keys are commonly shown without padding.
Is Base32 a form of encryption?
No. It's a reversible notation. A TOTP secret is secret because of the bytes themselves, not because of how they are written.
Sources
- RFC 4648 — §6 Base32, §7 base32hex, §10 test vectors
- RFC 6238 — TOTP: Time-Based One-Time Password Algorithm
- RFC 5155 — DNSSEC NSEC3 (uses base32hex)
- Google Authenticator — Key Uri Format
Last reviewed: