Base32 to Base64 Converter
Convert Base32 encoded data to Base64 and vice versa. RFC 4648 compliant real-time encoder/decoder with file upload, copy, and download.
About
Base32 and Base64 are binary-to-text encoding schemes defined in RFC 4648. Base32 uses a 32-character alphabet (A - Z, 2 - 7) and maps every 5 input bytes to 8 output characters, producing ~160% size overhead. Base64 uses 64 characters and maps 3 bytes to 4 characters, yielding ~133% overhead. Choosing the wrong encoding in protocol integration causes silent data corruption - TOTP tokens (RFC 6238) require Base32 secrets, while MIME attachments and JWTs demand Base64. This tool decodes the source encoding to raw bytes, then re-encodes into the target format with strict padding and alphabet validation.
Conversion is lossless for any valid input. Malformed padding or illegal characters are rejected with a specific error offset. Note: this tool processes standard alphabets only - Base32hex (RFC 4648 Β§6) and Base64url are not equivalent and will produce incorrect results if pasted here without prior normalization.
Formulas
Base32 encoding maps each group of 5 input bytes (40 bits) into 8 output characters, where each character represents 5 bits. The output length for n input bytes is:
Base64 encoding maps each group of 3 input bytes (24 bits) into 4 output characters, where each character represents 6 bits:
The conversion pipeline is: Source Encoding β decode to raw byte array β Target Encoding. For Base32 decoding, each character is mapped to its 5-bit index bi via the alphabet lookup. The bits are concatenated into a continuous stream, then sliced into 8-bit bytes:
Where L32 = output length in characters (Base32), L64 = output length in characters (Base64), n = number of raw input bytes, bi = 5-bit value of the i-th Base32 character, bytej = the j-th reconstructed byte from the bitstream. Padding characters (=) signal unused trailing bits and are stripped before bit extraction.
Reference Data
| Property | Base32 (RFC 4648) | Base64 (RFC 4648) |
|---|---|---|
| Alphabet size | 32 | 64 |
| Characters used | A - Z, 2 - 7 | A - Z, a - z, 0 - 9, +, / |
| Padding character | = | = |
| Bits per character | 5 | 6 |
| Input group size | 5 bytes | 3 bytes |
| Output group size | 8 chars | 4 chars |
| Size overhead | 160% | 133.3% |
| Case sensitive | No | Yes |
| Valid padding counts | 0, 1, 3, 4, 6 | 0, 1, 2 |
| Common use: Authentication | TOTP/HOTP secrets (RFC 6238) | HTTP Basic Auth |
| Common use: Email | Rare | MIME attachments (RFC 2045) |
| Common use: Web | Onion addresses (Tor v3) | Data URIs, JWTs |
| Common use: DNS | DNSSEC (RFC 4034) | DKIM signatures |
| Common use: Filesystem | Case-insensitive paths | Rarely (slash conflicts) |
| Hex variant exists | Base32hex (0 - 9, A - V) | Base64url (-, _) |
| Encoding βHelloβ | JBSWY3DP | SGVsbG8= |
| Encoding βfβ | MY====== | Zg== |
| Encoding βfoβ | MZXQ==== | Zm8= |
| Encoding βfooβ | MZXW6=== | Zm9v |
| Encoding βfoobβ | MZXW6YQ= | Zm9vYg== |
| Encoding βfoobaβ | MZXW6YTB | Zm9vYmE= |
| Encoding βfoobarβ | MZXW6YTBOI====== | Zm9vYmFy |
| RFC specification | RFC 4648 Β§6 | RFC 4648 Β§4 |