I have a strong random value that looks something like 4?1V*8G?ۑL?? (it is actually even worse as some of the characters were changed to ? when pasting it here).

I can convert it to a hexidecimal value such as c8e40ef3764af28d06e25020255a51ed, but it is still pretty long.

To make it shorter, I am thinking of using numbers and the full (English) alphabet instead of only 0 to 9 and a to f.

EDIT. From a technical prospective, I think I will need a total of 64 characters to encode the values for minimum length which means 0-9, a-z, A-Z, plus two more such as * and !. I could exclude some of the letters, but will need to use other characters such as % for each I exclude. This will result in something like jKTB*BbNswbkXJpjy7!4X3. Is this worse that something like c8e40ef3764af28d06e25020255a51ed? If I go this route, which characters should be used?


  1. Should both lower and upper case letters be used? This will shorten the string, but might make it more difficult to type.
  2. Should any characters be excluded? For instance, 0 (zero) and O (letter o) might be mistaken as well as 1 (one) and l (letter L), and U can accidentally appear obscene.
  3. Should it be formatted with hyphens, and if so, how?
  4. Any other recommendations?
  • 2
    In my opinion it should be formatted by space each four characters. Commented Dec 28, 2015 at 14:44
  • @AntonDozortsev What about using both lower and upper case letters? Commented Dec 28, 2015 at 14:45

2 Answers 2


1) Absolutely do not distinguish between upper-lower case. (So, i can type EITHER abc or Abc or aBc, and it works.)

(In presenting the string, do use only UPPER case letters, of course: they are clearer. But the user can enter either with no difference.)

2) Absolutely do not use any of the "problem" letters/digits that look like other letter/digits, completely omit these from your mix.

3) Absolutely present in groups of four. And only four, don't have say a group of three on the end.

(Separate with either a dash or a space, doesn't matter. But ensure that on entry, they can be entered with either hyphen, space, or with no separator.)

4) Note that, and this helps a lot, once it is longer than about 16 or 20 characters, it just doesn't matter at all how long it is. if it's going to be 20, it's no difference if it ends up being 28 or 32. (Physically, it's extremely unlikely this would ever be needed, but just saying.)

But here's the critical point:

Should you use letters only, digits only, or letter-digit mix?

Now: arithmetic fans will be quick to point out that "the string can be shorter with a longer set!". But I am quick to point out that length just doesn't matter at all; it's impossible to remember either way so there's no difference.

So in answer to the critical question, Should you use letters only, digits only, or letter-digit mix .... IMO, you're actually by far best to simply use only digits.

8762 1289 0900 1928 2882 0912 3871

is just plain more KISSer than


With the "mix" there is immediately many possible confusions .. "is this octal?" "why does one group have no numbers, is that a mistake?" "Is that an 'i'?" - the whole thing is just annoying.

(When using only-digits, among other advantages issues (1) and (2) above disappear!)

Note that, indeed, 16 digit credit card numbers are an example of this. Sure, they could have added letters to the mix (for "more combinations"). But think how tense it would be; they made the KISS choice.

Another illumination: if you are dealing with extremely short strings - say two letters then three numbers - and always in that fixed order, whenever you see it know the first two are letters and the next three are numbers - then you can get away with having letters (for the sake of having more combinations). Indeed ... that's what car license plates are. Anything longer .. letters should be taken out of the mix, not KISS and no advantage.

  • Hi Joe, Nice answer! I agree numbers seem easier. Given the possible ranges of my random value, I could either use 26 alphanumerical characters or 39 numbers. Probably should consider making the possible range smaller! Commented Dec 28, 2015 at 18:00
  • thanks, just my opinions! yeah that does seem like an awfully big range.
    – Fattie
    Commented Dec 29, 2015 at 0:31
  1. Nope, don't mix Upper and lower(as said by Joe Blow) but I'm not sure which one should you prefer as Upper Case is easily understood but you have to turn Caps Lock on or press shift.

  2. If possible, exclude any character though would require Shift key. This will only slow the user down and chances of errors will increase.

  3. Use space to keep characters apart, other will only confuse the user.

  4. You can use chunking strategies to make it even better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.