# generate-password

> Easy library for generating unique passwords.

Latest version **1.7.1** (published 2023-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install generate-password
pnpm add generate-password
yarn add generate-password
bun add generate-password
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.1 |
| Published | 2023-10-18 |
| First published | 2014-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 359 |
| Author | Brendan Ashworth |
| Maintainers | brendanashworth |
| Keywords | generate, password, generator, unique |

## Links

- npm: https://www.npmjs.com/package/generate-password
- Repository: https://github.com/brendanashworth/generate-password
- Issues: https://github.com/brendanashworth/generate-password/issues
- npm.io page: https://npm.io/package/generate-password

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.7.1 (latest) — 2023-10-18
- 1.7.0 — 2021-11-09
- 1.6.1 — 2021-07-21
- 1.6.0 — 2021-01-14
- 1.5.1 — 2020-02-11
- 1.5.0 — 2020-01-19
- 1.4.2 — 2019-06-16
- 1.4.1 — 2018-10-28
- 1.4.0 — 2018-01-21
- 1.3.0 — 2016-12-28
- 1.2.0 — 2016-09-26
- 1.1.1 — 2014-12-24
- 1.0.2 — 2014-11-15
- 1.0.1 — 2014-11-15
- 0.0.2 — 2014-07-24
- … 1 more at https://npm.io/package/generate-password/versions

## README

# Generate Password [![Build Status](https://travis-ci.org/brendanashworth/generate-password.svg?branch=master)](https://travis-ci.org/brendanashworth/generate-password) [![codecov](https://codecov.io/gh/brendanashworth/generate-password/branch/master/graph/badge.svg)](https://codecov.io/gh/brendanashworth/generate-password)

[![Generate-Password NPM](https://nodei.co/npm/generate-password.png?downloads=true&downloadRank=true)](http://npmjs.org/package/generate-password)

> Generate Password is a (relatively) extensive library for generating random and unique passwords.

## Install

```bash
$ npm install generate-password --save
```

## Usage

#### `generate([options])`

Generate one password with the given options. Returns a string.

```javascript
var generator = require('generate-password');

var password = generator.generate({
	length: 10,
	numbers: true
});

// 'uEyMTw32v9'
console.log(password);
```

#### `generateMultiple(amount[, options])`

Bulk generate multiple passwords at once, with the same options for all. Returns an array.

```javascript
var generator = require('generate-password');

var passwords = generator.generateMultiple(3, {
	length: 10,
	uppercase: false
});

// [ 'hnwulsekqn', 'qlioullgew', 'kosxwabgjv' ]
console.log(passwords);
```

### Available options
Any of these can be passed into the options object for each function.

| Name                     | Description                                                           | Default Value |
|--------------------------|-----------------------------------------------------------------------|---------------|
| length                   | Integer, length of password.                                          | 10            |
| numbers*                 | Boolean, put numbers in password.                                     | false         |
| symbols*                 | Boolean or String, put symbols in password.                           | false         |
| lowercase*               | Boolean, put lowercase in password                                    | true          |
| uppercase*               | Boolean, use uppercase letters in password.                           | true          |
| excludeSimilarCharacters | Boolean, exclude similar chars, like 'i' and 'l'.                     | false         |
| exclude                  | String, characters to be excluded from password.                      | ''            |
| strict                   | Boolean, password must include at least one character from each pool. | false         |

*At least one should be true.

### Using this with a browser
As browsers don't have the "require" method that Node.js does, this module doesn't work in web environments. Instead [generate-password-browser](https://www.npmjs.com/package/generate-password-browser) can be used.

---
_Source: https://npm.io/package/generate-password · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
