Hex to Base32 Converter
Encode hex bytes as RFC 4648 Base32 — the byte encoding used in TOTP 2FA secrets and Crockford-style IDs, not a positional numeral system.
How Hex to Base32 Encoding Works
Treat the hex input as a sequence of bytes (every 2 hex digits = 1 byte). Concatenate all the bytes' bits into one long bit string, split that into 5-bit chunks, and map each chunk to one of Base32's 32 characters (A-Z, 2-7). Pad the output with = characters until its length is a multiple of 8.
Hex to Base32 Example, Step by Step
"Hello" in hex = JBSWY3DP
48656C6C6F (hex) = JBSWY3DP (Base32)
Bytes: 48 65 6C 6C 6F (the ASCII text "Hello") 5 bytes = 40 bits = exactly 8 Base32 characters No padding needed
| Step | Description | Result |
|---|---|---|
| Read as bytes | 48 65 6C 6C 6F — 5 bytes total | 5 bytes |
| Split into 5-bit chunks | 40 bits / 5 = exactly 8 chunks | 8 chunks |
| Map each chunk to Base32 | using the A-Z, 2-7 alphabet | JBSWY3DP |
5 bytes (40 bits) divides evenly into 5-bit chunks with nothing left over, which is why this example needs no = padding.
Common Mistakes With Hex to Base32
- Confusing this with Base36 or a positional numeral system — RFC 4648 Base32 encodes bytes, not a single number.
- Forgetting an odd hex digit count needs a leading zero to complete the last byte.
- Manually typing 0, 1, 8, or 9 into decoded output, which don't appear in standard Base32.
Frequently Asked Questions
Is this Base32 the same kind of thing as Base36?
No, and this is a common mix-up. Base36 is a positional numeral system for representing one number compactly. This Base32 is RFC 4648's byte encoding, which turns raw bytes into text — it's not representing a single number in base 32 at all.
How does RFC 4648 Base32 encoding work?
It groups the input's bits into chunks of 5 (since 32 is 2^5), maps each 5-bit chunk to one of 32 letters/digits (A-Z and 2-7), and pads the output with = characters to a multiple of 8 characters.
Why does Base32 use A-Z and 2-7 specifically, skipping 0, 1, 8, 9?
To avoid visual confusion between similar-looking characters — 0/O, 1/I/L, and so on — which matters since Base32 is often typed by hand, unlike Base64.
Where is Base32 actually used?
TOTP-based two-factor authentication secrets (the codes you scan or type into an authenticator app) and some URL-safe or human-typeable ID schemes use Base32.
How does hex input map to bytes for encoding?
Every 2 hex digits is treated as one byte. An odd number of hex digits gets a leading zero added to complete the final byte before encoding.
Why does the output sometimes end in = characters?
Base32 always pads its output to a multiple of 8 characters — the = signs fill out the last group when the input's byte count doesn't divide evenly into 5-byte blocks.