What is the format of Minecraft.net account names?
The username must be between 3 and 16 characters (inclusive).
The characters permitted are :
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
Usernames are case-sensitive in games (above your head), but when logging in using the username, whether is it in caps or not, will still work.
Trying to register with an illegal character gives an error and mentions the following as allowed:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
And the longest username I could register was 'thisisalongusern'