Smart Deals - promotions, discount codes and sales

Password Validation Regex Generator

Fast, accurate and free online password validation regex generator tool running directly in your browser.

Secure (SSL)
Client-Side Processing
100% Free
Instructions
  • 1
    Enter data
    Enter content, paste text or load a file from disk.
  • 2
    Click the button
    The tool will immediately process your data in the browser.
  • 3
    Get the result
    Copy the finished text or save the file to your device.
function runTool() {
  return "Result ready in 0.1s";
}
~^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!@#$%\^&*()\-_=+[\]{}:,.?/])[A-Za-z0-9!@#$%\^&*()\-_=+[\]{}:,.?/]{12,64}$~
/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!@#$%\^&*()\-_=+[\]{}:,.?\/])[A-Za-z0-9!@#$%\^&*()\-_=+[\]{}:,.?\/]{12,64}$/
Password Result
CorrectHorseBatteryStaple!7 ✓ Pass
P@ssw0rd ✗ Rejected
S0methingStrong#2026 ✓ Pass
no-uppercase-7! ✗ Rejected
N0SpecialCharsHere ✗ Rejected
leadingSpace7! ✓ Pass
LongButValid_7!WithBrackets[] ✓ Pass
ASCII Mode Pattern: ^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!@#$%\^&*()\-_=+[\]{}:,.?/])[A-Za-z0-9!@#$%\^&*()\-_=+[\]{}:,.?/]{12,64}$
Full Source Preview (JSON)
{
    "output": "Password regex (pattern only):\n^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[!@#$%\\^&*()\\-_=+[\\]{}:,.?/])[A-Za-z0-9!@#$%\\^&*()\\-_=+[\\]{}:,.?/]{12,64}$\n\nJavaScript:\n/^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[!@#$%\\^&*()\\-_=+[\\]{}:,.?\\/])[A-Za-z0-9!@#$%\\^&*()\\-_=+[\\]{}:,.?\\/]{12,64}$/\n\nPHP (PCRE):\n~^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[!@#$%\\^&*()\\-_=+[\\]{}:,.?/])[A-Za-z0-9!@#$%\\^&*()\\-_=+[\\]{}:,.?/]{12,64}$~\n\nRules:\n- Length: 12–64 characters\n- Match mode: Validate the entire password\n- Character policy: Allowed list only\n- Unicode mode: Off (ASCII)\n- Whitespace: No spaces or whitespace\n- Require uppercase: Yes\n- Require lowercase: Yes\n- Require a digit: Yes\n- Require a special character: Yes\n- Allowed special characters: !@#$%^&*()-_=+[]{}:,.?/\n\nTest results (PHP engine):\n[OK] CorrectHorseBatteryStaple!7\n[NO] P@ssw0rd\n[OK] S0methingStrong#2026\n[NO] no-uppercase-7!\n[NO] N0SpecialCharsHere\n[OK] leadingSpace7!\n[OK] LongButValid_7!WithBrackets[]",
    "raw": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[!@#$%\\^&*()\\-_=+[\\]{}:,.?/])[A-Za-z0-9!@#$%\\^&*()\\-_=+[\\]{}:,.?/]{12,64}$",
    "tests": [
        {
            "value": "CorrectHorseBatteryStaple!7",
            "pass": true,
            "error": null
        },
        {
            "value": "P@ssw0rd",
            "pass": false,
            "error": null
        },
        {
            "value": "S0methingStrong#2026",
            "pass": true,
            "error": null
        },
        {
            "value": "no-uppercase-7!",
            "pass": false,
            "error": null
        },
        {
            "value": "N0SpecialCharsHere",
            "pass": false,
            "error": null
        },
        {
            "value": "leadingSpace7!",
            "pass": true,
            "error": null
        },
        {
            "value": "LongButValid_7!WithBrackets[]",
            "pass": true,
            "error": null
        }
    ],
    "meta": {
        "php_flags": "",
        "js_flags": ""
    }
}

Rate this tool:

Related tools

Other tools you may find useful

Password Validation Regex Generator - Create precise regular expression patterns online

Our free password validation regex generator allows you to instantly create complex regular expressions tailored to your application's security policy.

Why use regular expressions (regex) for password validation?

Regular expressions (regex) are an extremely powerful tool for finding and matching patterns in text. In the context of web application security, regex is a standard solution used to verify that a password entered by a user meets the required complexity criteria before storing it in the database. This allows for quick validation both on the client side (in the browser) and on the server side.

Using strong password validation policies protects users against brute-force and dictionary attacks. Forcing users to use a mixture of letters, numbers and special characters makes password cracking much more difficult. However, writing regular expressions for such assumptions by hand can be difficult and error-prone, which is why an automatic generator is an invaluable help for every programmer.

What password security criteria can be defined using regex?

Using regular expressions, you can define almost any rules determining the complexity of the password. The most basic criterion is the minimum and maximum length of a string of characters. For example, modern security standards recommend using passwords of at least 8, and preferably 12 or more characters, which can be easily encoded in regex.

The next criteria concern the composition of the password. You may require at least one uppercase letter, at least one lowercase letter, and at least one number. Very often, a requirement is added to use at least one special character (e.g. exclamation mark, question mark, monkey or dollar). Our generator allows you to flexibly turn these options on and off depending on the specifics of the project.

How does the password validation regex generator work and how to use it?

Our regex generator has a simple and functional interface. The user does not need to know complicated regular expression syntax to get the correct pattern. Simply select the appropriate checkboxes in the configuration form, specifying what conditions the password must meet (e.g. presence of numbers, capital letters, special characters) and providing the desired length range.

Based on these preferences, the generator builds a complete regex pattern in real time. You receive ready-made code along with flags and an explanation of how to interpret individual elements of the expression. This allows you not only to download the code, but also to learn how to create regular expressions in practice.

To better understand how the generated patterns work, it's worth taking a look at a few examples. A simple regex requiring only a minimum of 6 characters and at least one digit looks completely different than the one used in banking systems. For passwords with a high security standard (minimum 8 characters, uppercase letter, lowercase letter, number, special character), positive forward assertion technology (lookahead) is used.

Such a pattern may take the form of sequences that check individual conditions regardless of their order in the password. Thanks to this, the user is not forced to enter characters in a specific pattern (e.g. letters first, then a number), which increases both the level of security and the convenience of entering the password.

How to implement the generated regex pattern in JavaScript, PHP or Python code?

Once you copy the generated regular expression, implementing it in your project is very simple. In JavaScript (both in the browser and Node.js), you can use the built-in RegExp object and the test() method, whic

Install Webp.pl Have the tools in your own pocket!