Password Policy Regex Generator

Set your password rules and get a regex and HTML pattern to paste into a sign-up form. Test passwords against the rules, or generate strong passwords that meet them.

1. Password Generator

Character Sets

2. Policy Checker

Strength Evaluation N/A

Live Policy Checklist

Minimum 8 characters
At least 1 uppercase letter
At least 1 lowercase letter
At least 1 number
At least 1 symbol

3. Policy Settings & Export

How to turn a password policy into a regex

Set the minimum length and how many uppercase letters, lowercase letters, numbers and symbols a password needs. The tool writes a regular expression that enforces exactly those rules, plus an HTML pattern attribute and a short JavaScript check you can paste into a sign-up form. Type a password into the checker to see which rules it passes before you ship the policy.

How the regex works

Each rule becomes a lookahead at the start of the pattern. For example, (?=(?:.*[A-Z]){2}) means "somewhere in the password there are at least two uppercase letters". The final .{12,} sets the minimum length. Because lookaheads don't consume characters, the rules can appear in any order in the password. A symbol is any character that is not an A–Z letter, a digit or a space, so accented letters such as é also count as symbols.

Validate on the server too

Browser checks can be bypassed, so use the same regex or rules on your server. Length matters more than complexity: current NIST guidance favours longer passwords and checking against lists of breached passwords over strict character rules, so consider a minimum of 12 or more characters.

Frequently asked questions

Action completed!