How to use the base32 encoder and decoder
- Choose Encode or Decode, and the alphabet: RFC 4648 (A to Z and 2 to 7) or extended hex (0 to 9 and A to V).
- To encode, type text or enter hex bytes, and choose whether to add `=` padding.
- To decode, paste Base32. Case, spaces and hyphens are ignored.
- Read the encoded or decoded result, the byte count and the bytes as hex.
Formula
write the bytes as a stream of bits and cut it into 5 bit groups (values 0 to 31)
RFC 4648 alphabet: 0 to 25 = A to Z, 26 to 31 = 2 to 7
extended hex alphabet: 0 to 9 = 0 to 9, 10 to 31 = A to V
with padding, = signs are added until the length is a multiple of 8
The last group is filled with zero bits when it is short. Every 5 bytes become 8 characters, so Base32 grows data by 60%.
The word "foobar"
The six bytes of "foobar" are 66 6f 6f 62 61 72. As 48 bits they split into ten 5 bit groups and a leftover of 3 bits, which is filled with zeros to make an eleventh group. In the RFC 4648 alphabet the result is MZXW6YTBOI with six = signs of padding, so MZXW6YTBOI======.
With the extended hex alphabet the same bytes encode to CPNMUOJ1E8======. Without padding, the encoding is MZXW6YTBOI. Decoding MZXW6YTBOI====== returns foobar. The encoding for "f" alone is MY====== in the standard alphabet.
Why use Base32
Base32 uses only one case of letters and the digits 2 to 7, which avoids look-alikes such as 0 and O or 1 and l. That makes it good for codes that people read aloud or type, and it survives systems that ignore the case of a file name. One-time password secrets are commonly shared in this form.
Strict decoding
The decoder rejects characters outside the alphabet, padding of the wrong length and unused bits that are not zero, because those cannot come from a valid encoding. Base32 is a way to write bytes as text, not encryption. See also the Base64 Encoder and Decoder, the Ascii85 Encoder and Decoder and the Number Base Converter. All work happens in your browser.
Assumptions and limits
- Text is encoded as UTF-8 bytes.
- Input is limited to 200,000 characters.
- Crockford and other Base32 variants are not included.
- Nothing is sent from your device.
Frequently asked questions
What is the difference between the two alphabets?
The RFC 4648 alphabet is A to Z and 2 to 7. The extended hex alphabet is 0 to 9 and A to V, which keeps the sort order of the encoded text the same as the order of the bytes.
Is padding required?
Padding with = brings the length to a multiple of 8. Many systems omit it. The decoder accepts input with or without padding, as long as any padding that is present is valid.
Why does decoding fail on lowercase letters?
It does not. The decoder converts to upper case first, so lower case input works. Failures come from characters outside the alphabet, such as 0, 1, 8 and 9 in the standard alphabet.
Can I decode a one-time password secret?
Yes, but treat such a secret with care. The page runs in your browser and does not send it anywhere, but avoid pasting real secrets on a shared computer.