enter image description here


enter image description here

What is the reasoning behind allowing only letters as the first characters of a username?

  • 2
    The only thing I can think of would be if you wanted to make an alphabetical name listing and didn't want to include a "numbers" category. Still not a good reason, I suspect a popular site once did this and lots of sites copied them for no reason.
    – Ben Brocka
    Commented Jan 15, 2012 at 17:47
  • 2
    For Skype a possible reason can be that you can call a user by username or phone number. It can be a way to distinct between them.
    – pritaeas
    Commented Jan 18, 2012 at 21:25

8 Answers 8


An advantage of this restriction is URLs.

If a user's ID is 177896 and their username is H4rold, then you can have 2 URLs to reach this user depending on which information you have at hand:


Then, on that page, they determine how to look up the user by checking whether the first character is a letter or a digit. Alternatively, they could just force you to include at least one non-numeric character, though that increases the complexity of the check from a character comparison to either a regular expression or a looping multiple-character comparison.

However, not all websites with these restrictions take advantage of this flexibility. My theory is that web developers have seen this restriction so often that they just took it as the norm rather than investigating its purpose... We do that, sometimes.

  • This is the exact reason why we do this in our current project.
    – JohnGB
    Commented Jan 19, 2012 at 20:58
  • This is particularly useful if you use the numeric form as a persistent unique user id, because you can then allow the user to change their username if they so wish. This all breaks down if you then allow users to have usernames that mimic UUIDs.
    – Erics
    Commented Jan 20, 2012 at 10:51

I can think of no compelling UX reason for this. It is especially annoying when a username is taken, and a simple numeric variation is rejected. Great, now I have to remember another set of credentials.

So, from a UX perspective: no, this is not good practice.


There is usually a restriction on variable names in languages starting with characters ( and not including spaces - ALGOL was a notable exception to this, which allowed pretty much anything, becasue it used other methods for identifying a variable ). It may be that this idea has progressed into username definition, but there is not reason for this.

IME, as a software developer, there is absolutely not reason for insisting in a character at the start. And it is wrong to make these sort of restrictions when there is no real reason for it.


It might have something to with the fact that in XML, an ID has to start with a non-numeric character.

  • 4
    That maybe a technical reason, but I doubt it. There would be many ways around it. Plus I wouldn't expect to see the user's name as an identifier in any xml I can think of. It would be between identifying tags, but it would not be an identifier. If there is a technical reason for this, it is more likely to be that the IsIdent function is (unjusitifiably) used to check the user's name and IsIdent imposes this limitation. Commented Jan 14, 2012 at 16:21
  • 1
    I believe this convention is older than XML (it was first a W3C recommendation in 1998). Commented Jan 15, 2012 at 3:56
  • As a convention, it dates back to at least 1966 (BCPL). Source
    – MSalters
    Commented Jan 17, 2012 at 16:07

In the early days before PCs became ubiquitous, numeric-only IDs were the norm. Examples of this are phone numbers, various identity numbers (SSN), even usernames on some early computer networks (CompuServe).

The requirement for a first character to be a letter could have been a way to encourage users to create readable usernames and break their habit of choosing only digits. Even if this rationale no longer applies, the restriction may stick around out of habit, or to allow working with legacy systems.


Aside from what others have written, there is really only one other reason I can think of. In many programming languages (such as PHP, JavaScript, etc...) variables must start with a non-numeric character (as mentioned in several answers).

Based on that and depending on how the programmers use the information, it could be they plan to turn the username into a variable at some point for at least one purpose or another. This may sound odd because you would think "why would anyone do that? It would be hard to program a variable if the variable is always changing". However, PHP supports variable-variables. Though not used often, they do have their moments. If they do create variable-variables, then they would need to insure there is a proper character at the end.

I know it's a long shot, but that's the only other reason I can think of.

  • That's not entirely true in PHP, and ironically because of the exact mechanism you mentioned. Syntactically, you're right; variables have to start with an underscore or letter. However, the symbol table itself will accept any string as a variable name. So $username = '1messed-up^user!name@'; $$username = 'foo'; echo $$username; will run just fine and output "foo". And if you look at the symbol table using get_defined_vars(), you'll see that the variable 1messed-up^user!name@ does indeed map to the value "foo". Commented Jan 20, 2012 at 15:13
  • Thanks Lèse, I did not know that part. I have never used them, I have just seem them in code before and read about them. That's a great tip. Thanks for sharing! Hopefully I never need it, because the only time I see them is to deal with complicated situations ;)
    – eckenroed
    Commented Jan 20, 2012 at 17:34

This may be an attempt to enforce more legible usernames. We're used to referring to people using names that are comprised of letters and words, whether it's a legal name or nickname. For online handles, we may append numbers to the nickname to create variations on a name that's already taken, and most people will conveniently ignore the numeric suffix.

From a usability standpoint, bob316 is a much better username than 316bob because:

  1. It's easier for others to identify you as simply "bob" when they see the name portion in front. Putting the name in front makes it stick out more, and it should be easier for others to read the username until they hit a number and discard the rest rather than read the numbers until they hit a letter and begin parsing the name.

  2. Similarly, it also makes it easier to scan for the person's name visually without knowing the numeric portion of their username. It's much easier to ignore numbers after a name than having to look for where the actual name begins in a string of characters. Also, we read largely by looking at the outlines of words, so distinctive word outlines facilitate reading (also why all-caps is harder to read than normal capitalization). Numbers have less distinct outlines than letters/words, so having them in front would make it harder to identify during quick scans.

  3. It makes it much easier to find the username in an alphabetical list. If you know your friend's name is "Bob" then you can simply look in the "B" section of a list or directory rather than checking every number.

  4. It makes auto-complete easier to implement. It would take longer to auto-complete if I were to type in "316bob" since the most unique/relevant part of the username is at the end; and simply typing "bob" would not get the suggestion of "316bob" in many systems. (Not strictly a usability issue, but ease of implementation does increase user access to this usability feature in practice.)

In addition to usability, a website might also discourage or forbid users from starting their username with a number because of compatibility issues. For instance, subdomains can't start with numbers (at least according to cPanel), so it makes it easier to have personalized subdomains for each user this way.

  • From usability standpoint, 3M is much better username than M3, because the name of the company is 3M, not M3. Commented Apr 13, 2020 at 17:43

As noted by the answers, I don't think this is related to usability. Like Shroedingers Cat my first impression is that this is related to the restriction of variable names or other identifiers in software; usernames have simply inherited these restrictions, possibly due to habit or re-use of validation code.

The question is, why were other identifiers restricted this way?

Some possibilities:

  • If you want to use "7d" to denote "7 in decimal" or "7 as a double-precision floating point number" then that immediately rules it, and anything like it, out as a variable name. Something like 7d = 7d; would be ambiguous at best and dangerous at worst. Similarly names with only numbers are right out.

  • It makes parsing easier if you can assume that any token beginning with a digit is a number. Writing a regex that handles forms like "7001", "700d", and "700dd" appropriately is more complicated if you're using some of them as identifiers. (Not to mention that 700dd is a valid hex number, so you'd have to account for a prefixing "0x" or similar as well.)

  • The use of whitespace and line numbers could also be a factor; see Roy Dictus's answer on a related Stack Overflow question.

These issues can be overcome, and some programming languages allow identifiers that start with digits, but it's certainly true that it's easier and simpler to disallow it. Allowing it doesn't provide anything that I would consider a benefit in exchange for the complexity (however slight).

Now it is entirely possible that there are some usability-related reasons for this as well. Pure speculation:

  • Before login systems like this and usernames like surferdude99 were common, I would presume that an architect of such a system thought of identifiers as actual, you know, identifiers. Something like matt.read. Given two people with the name name, matt.read1 and matt.read2 make perfect sense. 2matt.read is less natural and certainly something like 27blah234q doesn't mesh with that system, so number-first identifiers were disallowed.

  • Something like 99OO looks like 9900. Of course OO99 suffers the same issue, but people are less used to seeing numbers with leading zeroes, so only the former case was disallowed. Possibly, the common standards of case insensitivity and presentation of usernames as all lowercase are related to solving these problems.

  • 3
    You would never use a person's username as a variable name. A person's username is the value of a string variable. Strings are not restricted to start with an alphabetical character. Usernames are often stored stored in a SQL database as a varchar, which also has no restriction on whether it starts with a number or not.
    – JoJo
    Commented Jan 15, 2012 at 4:57
  • 2
    @JoJo Yes, obviously. I didn't say that. I think usernames have inherited the restrictions historically put on other identifiers, such as variables. I've made a clarifying edit. Commented Jan 15, 2012 at 5:04
  • 2
    Also, where would you use a username as a decimal, double, or hex? Why point out limitations of types that are totally unrelated to strings, which usernames are always stored as? Lastly, tell me which compiler struggles with regexes just because I write the line String username = '700dd'. I haven't found any compiler that confused the string "700dd" as a hex.
    – JoJo
    Commented Jan 15, 2012 at 8:50
  • 2
    Good explanation. I think that it makes sense that programmers used to thinking of names (identifiers) as beginning with a letter would impose the same limitation on usernames because they didn't put enough thought into it to overcome status quo bias. Commented Jan 15, 2012 at 20:50
  • @JoJo I've said quite clearly that I am guessing usernames merely inherited restrictions placed on other identifiers. I didn't say usernames would ever be treated as variable names, numbers, or anything else. Finally, your example does not match what I wrote. If you have a better theory for why username restrictions happen to be be like this, put it forward. I wouldn't haven chosen to restrict usernames like this myself, it seems nonsensical, but given the commonalities with restrictions on other identifiers it would appear that someone else did not quite think the same way as us. Commented Jan 16, 2012 at 4:45

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.