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.
Where Encoding to Base32 Actually Comes Up
Provisioning a New TOTP 2FA Secret
Setting up two-factor auth from scratch means generating random bytes and encoding them as Base32 — this is that exact encoding step before the secret gets shown as a QR code.
random bytes -> Base32 secret
Creating a URL-Safe Identifier
Base32's alphabet needs no URL-encoding and avoids visually confusing characters, making it a solid choice for short IDs embedded directly in links.
hex ID -> Base32 URL slug
Producing a Human-Typeable Code
When someone needs to read a code aloud or type it by hand (a device pairing code, a recovery key), Base32's restricted alphabet avoids the 0/O and 1/I/L mix-ups that plague other encodings.
hex bytes -> typeable code
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.
Why Use This Calculator Instead of Doing It by Hand
- Handles bit grouping and padding automatically, no manual bit math
- Runs entirely in your browser — nothing you type gets sent anywhere
- Pads odd-length hex input with a leading zero automatically
- Produces standard RFC 4648 output compatible with authenticator apps
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.
How do I generate a TOTP secret from hex-encoded random bytes?
Generate your random bytes as hex first, then encode them here — the Base32 output is what authenticator apps expect when you provision a new 2FA secret.
Is Base32 output safe to put directly in a URL?
Yes — Base32's alphabet avoids characters that need URL-encoding, which is exactly why it's a common choice for short IDs embedded in links.