Base32 Encode
Encode and decode text to Base32 format (RFC 4648). Supports UTF-8 input, padding options, and instant copy to clipboard.
About
Base32 encoding transforms arbitrary binary data into a restricted alphabet of 32 ASCII characters (A - Z and 2 - 7) plus the padding character =, as specified in RFC 4648 ยง6. Each group of 5 input bytes (40 bits) maps to 8 output characters, producing roughly 160% size expansion. The encoding is case-insensitive by specification, which makes it suitable for environments that are not binary-safe or that fold letter case - DNS labels, file systems, TOTP secret keys (RFC 6238), and onion addresses all rely on Base32 for this reason. Incorrect implementation leads to silent data corruption: a single misplaced bit shifts all subsequent output. This tool performs byte-accurate RFC 4648 encoding with proper = padding and full UTF-8 support via the TextEncoder API.
Formulas
Base32 encoding operates on 5-byte input blocks. Each block of 40 bits is partitioned into 8 groups of 5 bits. Each 5-bit group indexes into the alphabet A - Z, 2 - 7.
where n = number of input bytes. The padding character count depends on the remainder r = n mod 5:
For decoding, each Base32 character maps back to its 5-bit value. The bits are concatenated, then split into 8-bit bytes. Trailing bits that do not form a complete byte are discarded. The per-character index function is:
where c is the ASCII code point of the character. Characters outside this set (except =) indicate a malformed input.
Reference Data
| Encoding | Alphabet Size | Characters Used | Bits per Char | Expansion Ratio | Case Sensitive | Padding | RFC | Common Use |
|---|---|---|---|---|---|---|---|---|
| Base16 (Hex) | 16 | 0 - 9, A - F | 4 | 200% | No | None | RFC 4648 ยง8 | MAC addresses, hashes |
| Base32 | 32 | A - Z, 2 - 7 | 5 | 160% | No | = | RFC 4648 ยง6 | TOTP, onion addresses |
| Base32hex | 32 | 0 - 9, A - V | 5 | 160% | No | = | RFC 4648 ยง7 | NSEC3 (DNSSEC) |
| Base64 | 64 | A - Z, a - z, 0 - 9, +/ | 6 | 133% | Yes | = | RFC 4648 ยง4 | Email (MIME), data URIs |
| Base64url | 64 | A - Z, a - z, 0 - 9, -_ | 6 | 133% | Yes | Optional | RFC 4648 ยง5 | JWT, URL parameters |
| Ascii85 | 85 | ! - u | 6.4 | 125% | Yes | Special | - | PDF, PostScript |
| z-base-32 | 32 | Human-friendly set | 5 | 160% | No | None | - | Mnet, Tahoe-LAFS |
| Crockford Base32 | 32 | 0 - 9, A - Z (excl. I,L,O,U) | 5 | 160% | No | None | - | ULID identifiers |
| Base58 | 58 | Alphanumeric (excl. 0,O,I,l) | 5.86 | 137% | Yes | None | - | Bitcoin addresses |
| UUencode | 64 | ASCII 32 - 95 | 6 | 133% | Yes | Length prefix | - | Legacy Unix mail |
| BinHex | 64 | Custom set | 6 | 133% | Yes | Special | - | Classic Mac OS |
| Base2 (Binary) | 2 | 0, 1 | 1 | 800% | N/A | None | - | Debugging, education |