Base32 Decode
Decode Base32-encoded strings to plain text or binary data instantly. RFC 4648 compliant decoder with hex output, file download, and copy support.
About
Base32 encoding represents binary data using a 32-character alphabet (A - Z and 2 - 7) defined in RFC 4648. Each character encodes 5 bits, so 8 encoded characters produce 5 bytes of output. Incorrect decoding - wrong alphabet, ignored padding, or mishandled bit alignment - silently corrupts data. This is particularly dangerous for TOTP secret keys, Onion service addresses, and binary file hashes where a single flipped bit invalidates the entire payload. This tool implements the full RFC 4648 specification including strict padding validation and provides both UTF-8 text and hexadecimal output so you can verify byte-level accuracy.
Note: this decoder assumes standard Base32 (RFC 4648 Β§6). It does not handle Base32hex (Extended Hex Alphabet) or Crockfordβs Base32. Input containing characters outside the valid alphabet is rejected. Whitespace and line breaks are stripped automatically before decoding.
Formulas
Base32 decoding maps each character to a 5-bit integer, concatenates all bits into a single binary stream, then extracts 8-bit bytes. The core relationship between encoded length and decoded byte count is:
Where nchars is the count of non-padding characters. Padding determines how many trailing bytes to discard from the final group:
The algorithm accumulates bits in a buffer b with a bit count k. For each character c: b = (b << 5) | lookup(c), then k = k + 5. Whenever k β₯ 8, extract the top byte: byte = (b >> (k β 8)) & 0xFF, then k = k β 8.
Valid padding counts per RFC 4648 are 0, 1, 3, 4, or 6. Counts of 2, 5, 7 are illegal and indicate corrupted input.
Reference Data
| Base32 Character | Decimal Value | Binary (5-bit) |
|---|---|---|
| A | 0 | 00000 |
| B | 1 | 00001 |
| C | 2 | 00010 |
| D | 3 | 00011 |
| E | 4 | 00100 |
| F | 5 | 00101 |
| G | 6 | 00110 |
| H | 7 | 00111 |
| I | 8 | 01000 |
| J | 9 | 01001 |
| K | 10 | 01010 |
| L | 11 | 01011 |
| M | 12 | 01100 |
| N | 13 | 01101 |
| O | 14 | 01110 |
| P | 15 | 01111 |
| Q | 16 | 10000 |
| R | 17 | 10001 |
| S | 18 | 10010 |
| T | 19 | 10011 |
| U | 20 | 10100 |
| V | 21 | 10101 |
| W | 22 | 10110 |
| X | 23 | 10111 |
| Y | 24 | 11000 |
| Z | 25 | 11001 |
| 2 | 26 | 11010 |
| 3 | 27 | 11011 |
| 4 | 28 | 11100 |
| 5 | 29 | 11101 |
| 6 | 30 | 11110 |
| 7 | 31 | 11111 |
| = | Padding (fills incomplete 8-character groups) | |