Makes generating simple or complex, appropriate passwords a breeze.

Usage no npm install needed!

<script type="module">
  import cityssmSimplePasswordGenerator from 'https://cdn.skypack.dev/@cityssm/simple-password-generator';



npm Codacy Badge Maintainability Test Coverage AppVeyor Snyk Vulnerabilities for GitHub Repo

Makes generating simple or complex, appropriate passwords a breeze.

  • Passwords can have a minimum or maximum length.

  • Passwords can include words, letters, numbers, and symbols.

  • Passwords are scanned with zxcvbn-typescript to reduce their guessability.

  • Passwords are translated with unleet, and scanned using badwords to make sure they are appropriate.


npm install @cityssm/simple-password-generator


import { generatePassword } from "@cityssm/simple-password-generator";

= "carPoetDRIVING%38"

generatePassword({ minLength: 15, pattern: "wnWnX" });
= "curious6COMPOSITION7B"

generatePassword({ pattern: 'xxxXXXnnns', doShufflePattern: true });
= "c0O4WG@od9"


Option Description Default
minLength The minimum password length. 8
maxLength The maximum password length. 50
pattern The format the password should use. "wCnn"
doShufflePattern Whether the pattern should be ordered randomly or not. false
minScore The minimum allowable zxcvbn guessability score, where 0 is "too guessable" and 4 is "very unguessable" 2
retries The number of times the generator should try to generate a password before failing and returning null. 20

Note that if your pattern cannot generate a password within your set minLength and maxLength, the generatePassword() function may return a null value.

Pattern Options

Pattern Character Description Example
w Lower case word word
W Upper case word WORD
C Capitalized word Word
x Lower case letter a
X Upper case letter A
n Number 9
s Symbol @