The alphabet
What is allowed
- Letters
- a b c d e f g h i j k l m n o p q r s t u v w x y z
- Digits
- 2 3 4 5 6 7
- Excluded
- 0 1 8 9 and every uppercase letter
- Total
- 32 symbols, which is exactly 5 bits
Why those four
Thirty-two is the number that matters, because five bits index exactly 32 values. Twenty-six letters leaves six slots, so six of the ten digits get in and four do not.
The four chosen for exclusion are the ones that collide visually with letters. Zero against the letter o, one against the letter l and in some faces the letter i, eight against the letter b in certain conditions, nine against the letter g. Take those out and the remaining 32 symbols are much harder to confuse with each other when a person is reading a long string off a screen.
Uppercase letters are excluded for a different reason. If both cases were allowed, two addresses differing only in capitalisation would be different addresses, and people would mistype them constantly. Restricting to lowercase removes the whole class of problem, and it also means an address can be safely lowercased anywhere without changing what it refers to.
Why the absence is a usable check
Most properties of an onion address cannot be checked by eye. This one can. If a string offered to you as an onion address contains a zero, a one, an eight, a nine or a capital letter, it is not a valid onion address. Not a suspicious one, not an old format, malformed.
That is a genuinely useful test because it takes a second and produces a definite answer. It is also completely one-sided. Passing it tells you nothing whatsoever, because every valid address passes it and so does every forged address, which is generated the same way. The alphabet check rules things out and never rules anything in.
Across the 672 characters of the twelve addresses on this site, no excluded symbol appears anywhere. Every record page reports the check as a pass, and the frequency table shows the same thing from the other direction, with no rows existing for symbols that never occur.
Questions
Can an onion address contain a capital letter?
No. The encoding is lowercase only. A string with capitals in it can be lowercased and may then be valid, but as written it is not in the correct form.
Why is the letter o allowed if zero is not?
Because only one of each confusable pair needed to go, and letters are more numerous and more useful than digits in an alphabet of this kind. Removing the digit keeps 26 letters intact.