This question already has an answer here:

Each user will have a unique username as it is going to be used to link to their profile page. As an example, in the following URL johndoe is the username http://www.example.com/user/johndoe. Are there any best practices that I need to follow? What characters should be allowed?

marked as duplicate by tohster, JonW Mar 15 '15 at 9:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • this is a question that has been asked many times both on this site and on other StackExchange sites. For example, see programmers.stackexchange.com/questions/87366/…. There are plenty more posts on this topic which will show up in a simple Google search. You have shown no effort to do any kind of research before asking the question, so it is a waste of the community's time. Please be more considerate in the future. – tohster Mar 15 '15 at 9:03
  • @tohster What's the best maximum length for a username? Why should I limit characters (Only a-z, 0-9 & underscores) like Twitter, Google and the others do? Also, the second link that you posted is about passwords, it has nothing to do with usernames – AlGallaf Mar 15 '15 at 9:07
  • @AlGallaf if a comment suggests that a post is a duplicate and the post is subsequently closed as a duplicate any comment that includes a link to that other post is automatically deleted. – JonW Mar 15 '15 at 10:14

While it is mostly depends on the requirements you have, points to note are

  1. Characters that conflict with the http addresses are to be omitted. Like # or /
  2. Characters that may get encoded while transmitting the data must be carefully looked into. Like spaces
  3. Use only ASCII characters.
  4. As an observation, alphanumeric usernames of length 6/8 or more supported with underscore or period, without spaces in between is a good one to start with.

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