Why are there dictionaries with 16, 32 or 64 symbols?
04Smaller dictionaries give each text symbol fewer bit places. The same data then needs a different number of symbols.
These letters stand for explicitly chosen ASCII byte values.
Original data pieces
Each tiny place is a bit: filled = on, empty = off.
What happens if you change this?
Make one change, then watch again. Restart restores the original example.
A different five-bit grouping needs its own alphabet and final-group rules.
Key idea: The dictionary size changes the number of bits named by each symbol, not the bytes we started with.
Terms
- Base encoding
- A reversible way to represent bytes with a selected alphabet of text symbols. It is not encryption.
- Alphabet
- The agreed dictionary of symbols. Base64 and Base64url use different alphabets.
- Byte / bit
- One byte contains eight on-or-off values called bits.
- Padding / pad bits
- Equals-sign ending marks / zero filling bits inside the final data symbol. They are different things.
- Profile
- The containing format’s explicit extra rules, such as whether padding is omitted.
- Canonical form
- A specified consistent spelling. Being decodable does not guarantee that spelling.
Rules & examples
The dictionary size changes the number of bits named by each symbol, not the bytes we started with.
- Base32 maps five-bit groups to 32 symbols.
- Base32hex uses the extended-hex alphabet of §7.
- Base16 maps each four-bit nibble to a hexadecimal character and needs no padding.
Examples are illustrative. Consult the linked RFC and its errata for implementation details.
RFC 4648 §§6–8. Base32 alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZ234567; Base32hex 0123456789ABCDEFGHIJKLMNOPQRSTUV; Base16 0123456789ABCDEF. Input 66 6F; output MZXQ====. 4 zero filling bits and 4 padding characters. Base16 maps nibbles and has no padding. This encoder writes uppercase; Base32 and Base16 readers here accept ASCII letter-case variants. Reported errata 4889/8669 are not verified replacements for the normative encoding rules; the implementation is checked against the RFC vectors and independent codecs.
Sources
New to this? Start hereA quick picture + helpful background
First, agree how to read the message.
An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.
Start with this guide; no earlier guide is needed for the overview.
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.