Encoding Tools
Base32 Encoder/Decoder - RFC 4648, Crockford & Base32hex
Encode and decode text or binary data using Base32 (RFC 4648 standard, Base32hex, or Crockford variant). Copy output with one click - runs entirely in your browser.
The standard Base32 alphabet defined in RFC 4648. Uses A–Z and 2–7. Used in: TOTP/2FA secrets, IPFS CIDs, file encoding.
What is Base32?
Base32 is a binary-to-text encoding scheme that represents arbitrary binary data as a sequence of printable ASCII characters. It uses an alphabet of 32 characters, making it case-insensitive and safe for use in URLs, file names, and DNS entries.
Compared to Base64, Base32 produces ~60% more characters but avoids characters that are easy
to confuse when typed by humans (such as 0/O or 1/I/l in the Crockford
variant).
Variants supported
| Variant | Alphabet | Common use |
|---|---|---|
| RFC 4648 (Standard) | A–Z, 2–7 | TOTP/2FA secrets, IPFS content IDs |
| RFC 4648 Base32hex | 0–9, A–V | NSEC3 DNS records, sortable IDs |
| Crockford Base32 | 0–9, A–Z (minus I, L, O, U) | Human-readable serial numbers |
Encoding efficiency
Every 5 bytes of input produces 8 Base32 characters (a 60% size increase). Padding (=) is added to make the output a multiple of 8 characters. Padding can be omitted when the
length is known by context.
Base32 vs Base64
| Feature | Base32 | Base64 |
|---|---|---|
| Alphabet size | 32 chars | 64 chars |
| Output size | +60% | +33% |
| Case-insensitive | Yes | No |
| URL-safe | Yes | Needs variant |
| Human typeable | Better | Harder |
Base32 in TOTP / two-factor authentication
Base32 (RFC 4648 standard variant) is the encoding format used for all TOTP secrets - the seeds shared between authenticator apps (Google Authenticator, Authy, 1Password) and services. When you scan a QR code to add an account, the QR code contains a URI like:
otpauth://totp/Example:user@example.com?secret=JBSWY3DPEB3W64TMMQ&issuer=Example
The secret parameter is a Base32-encoded 20-byte (160-bit) random seed. Base32 is chosen
because:
- It is case-insensitive (users can type it without worrying about case)
- It avoids visually ambiguous characters (no 0/O or 1/I/l confusion in Crockford variant)
- It can be typed by hand for manual account setup without a QR scanner
Encoding worked example
Encoding the ASCII string Hello step by step:
- Convert to bytes:
H=0x48, e=0x65, l=0x6C, l=0x6C, o=0x6F - Write as 40 bits:
01001000 01100101 01101100 01101100 01101111 - Split into 5-bit groups:
01001 00001 10010 10110 11000 11011 00011 01111 - Map each group to the RFC 4648 alphabet:
J B S W Y 3 D P -
Pad to a multiple of 8 characters:
JBSWY3DP(40 bits = 8 chars exactly - no padding needed here)
For the string Hello World the output is JBSWY3DPEB3W64TMMQ======.