Should passwords contain spaces?
Can passwords have spaces? Yes, passwords can contain spaces. There is absolutely no plausible reason for disallowing users to use spaces in the passwords. Today, practically all modern applications, systems and websites allow you to use spaces without a problem.
What is whitespace in a password?
In computer programming, whitespace is any character or series of characters that represent horizontal or vertical space in typography. When rendered, a whitespace character does not correspond to a visible mark, but typically does occupy an area on a page.
Why are there spaces at the end of passwords?
There’s a big benefit for not allowing users to use spaces at the beginning and end of passwords and that’s simply that it eliminates the problem which often arises when a user copies and pastes their password (e.g. from an email) and it includes white space which isn’t part of the password.
Do you trim the end of a password?
You should be hashing the password, so maximum character lengths and spaces at the end don’t matter. No, you should not trim it. You require a user to enter the password twice (when creating it) to eliminate typing errors. Therefore a space doesn’t matter.
Is it OK to remove a space from a password?
Space is a regular password character, and you shouldn’t remove it. Since you probably hash the password before storing it in the database, the space will be treated as any other character. I don’t care. So long as whatever you do to the password when it is being set is also done to it when being entered later on.
Do you have to have trailing spaces in passwords?
Anyone who might have to enter credentials in front of others should consider keeping a trailing space or three in their password, just in case. And when building authentication systems, you should never trim those spaces. I don’t care.