We are in the process of creating a web game where username is part of a user profile from the get go. This username will be visible to the user within the main game screen and also in the leader-boards and the profile page for everyone to view.

Since we don't want the username to either be truncated or continue in a second line, what is the optimal solution in regards to the minimum and maximum characters length?

Furthermore, what is the min/max characters for a password? Is there any reason to restrict the user from using as many as he wants?

Been thinking to be able to use alphanumeric characters, periods and underscores for usernames with min/max set to 4-12, but I don t know if there is a best common practice to follow here.

Thanks in advance for your help

  • @MattObee I read about it but i thought it might be outdated nowadays hence my question – Dimi May 15 '17 at 8:33
  • I am not quite sure why you would like to have a maximum length for username and password. No matter what this length is, the most important is to communicate it upfront to the user. nngroup.com/articles/password-creation – Dimitra Miha May 15 '17 at 8:33
  • @DimitraMiha Not only we need to set a length in the database for these but since usernames will be visible in leaderboards, main game page and profile pages we do not want to have a bad aesthetics result with usernames being truncated or not fitting in one line – Dimi May 15 '17 at 8:42
  • @Dimitris agreed. But then, you should give all the context in your question already. Because to me, this seems like a broad question. – Dimitra Miha May 15 '17 at 8:46
  • @DimitraMiha You are right Dimitra! I edited the question now to include more info, thank you! – Dimi May 15 '17 at 8:55

As far as max length is concerned, I'd say avoid it unless you have a bottleneck in the backend.

You can always use ellipsis (...) to truncate a long username to keep it from going to the next line.

Passwords should also be allowed to be as long as possible (at least 256 characters). Keep the checking real-time and inform the user about the restricted alphanumeric characters on-the-go by indicating it with red borders and a tooltip message or a pop-up

| improve this answer | |

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