How to use the Base32 encode / decode tool
- Choose Encode or Decode in the Operation list.
- Enter plain text to encode, or a Base32 string to decode, in the Text or encoded value box.
- Select Convert, or select Example to encode the sample text Hello, world! right away.
- Check the Result box. Encoded output is uppercase with = padding, and decoded output is shown as text when possible.
- Use Copy to take the text, or Download in Decode mode to save the bytes as decoded.bin.
How Base32 encoding works
Base32 turns bytes into text using 32 symbols: the letters A to Z for the values 0 to 25 and the digits 2 to 7 for the values 26 to 31. Each symbol carries 5 bits. The encoder joins the input bytes into one bit stream and cuts it into 5-bit pieces, so 5 bytes (40 bits) become exactly 8 characters.
When the input length is not a multiple of 5 bytes, the last piece is filled with zero bits and equals signs pad the output to a multiple of 8 characters. The digits 0 and 1 are skipped because they resemble the letters O and I.
A Base32 example, bit by bit
Take the two bytes of Hi: 48 and 69 in hex, or 01001000 01101001 in binary. Cut into 5-bit pieces that is 01001, 00001, 10100 and a final 1 that is filled out to 10000. The values 9, 1, 20 and 16 map to J, B, U and Q. Four characters are not a multiple of eight, so four equals signs are added.
Hi → JBUQ====
Hello, world! → JBSWY3DPFQQHO33SNRSCC===Input rules when you decode Base32
The decoder is forgiving about formatting and strict about the data. Decoded bytes are read as UTF-8. If they are not valid UTF-8, as with a random secret key, the Result box shows the byte count and a hex dump, and Download gives you the bytes unchanged.
- Lowercase letters are accepted, and spaces and line breaks are removed.
- Padding can be left out. If equals signs are present, they must sit at the end and bring the length to a multiple of 8.
- An impossible length, such as 1, 3 or 6 characters in the last block, gives the message Enter a complete Base32 value.
- The digits 0, 1, 8 and 9 and any punctuation are outside the alphabet and stop the decode.
- Unused bits in the last character must be zero. Otherwise the tool reports nonzero padding bits.
Where Base32 is used
Base32 shows up where a value must survive being read aloud, typed by hand or stored without regard to letter case. Authenticator apps exchange TOTP secrets as Base32 setup keys, and Tor onion addresses are lowercase Base32 without padding.
The cost is size. Base32 output is 60 percent larger than the input, against 33 percent for Base64. RFC 4648 also defines base32hex, which uses 0 to 9 and A to V. That variant and Crockford Base32 use other alphabets and need their own decoder.
Frequently asked questions
What characters are valid in Base32?
Standard Base32 uses the letters A to Z and the digits 2 to 7, plus the equals sign as padding at the end. This tool also accepts lowercase letters and ignores whitespace.
Can I decode a Base32 string without padding?
Yes. Many systems, including authenticator setup keys, drop the trailing equals signs. The decoder works out the byte count from the number of characters, so unpadded input decodes the same as padded input.
Why do I get the message about nonzero padding bits?
The final character can carry bits that do not belong to any byte, and a correct encoder sets them to zero. If they are not zero, the string was truncated, mistyped or made by a faulty encoder, so the tool refuses to guess.
How do I decode a TOTP secret key?
Paste the key, choose Decode and select Convert. Spaces between the groups of a setup key are fine. Secrets are random bytes, so expect a hex dump, not readable text.
Does the Base32 text I enter leave my browser?
No. Encoding and decoding are done by script in this page, which matters when the value is an authentication secret.