# What changed in nanoid

> 21 changes in nanoid 3 to 6 from its official release notes, upgrade guides and advisories: 1 breaking, 3 security, 1 new APIs and options. Each one cited. Sources checked 2026-10-17. HTML: https://unstale.sh/npm/nanoid/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## nanoid 6

### Breaking changes

- Support for Node.js 18 and 20 was removed. (6.0.0) — [release notes](https://github.com/ai/nanoid/releases/tag/6.0.0)

### Performance

- The JavaScript bundle size was reduced, which can benefit applications that bundle nanoid. (6.0.2) — [release notes](https://github.com/ai/nanoid/releases/tag/6.0.2)
- Improved customRandom performance when changing the requested size. (6.0.2) — [release notes](https://github.com/ai/nanoid/releases/tag/6.0.2)
- customAlphabet generation is 4 times faster. (6.0.0) — [release notes](https://github.com/ai/nanoid/releases/tag/6.0.0)
- nanoid generation is 4 times faster. (6.0.0) — [release notes](https://github.com/ai/nanoid/releases/tag/6.0.0)

### Fixes and other changes

- Fixed handling of floating-point size values passed to customRandom. (6.0.2) — [release notes](https://github.com/ai/nanoid/releases/tag/6.0.2)

## nanoid 5

### Security

- Fixed an infinite loop when size is negative. (3.3.16, 5.1.16) — [release notes](https://github.com/ai/nanoid/releases/tag/3.3.16), [release notes](https://github.com/ai/nanoid/releases/tag/5.1.16), [security advisory](https://github.com/advisories/GHSA-28WG-GHJ8-5HJV)
- nanoid: Integer Overflow or Wraparound (3.3.12, 5.1.11) — [security advisory](https://github.com/advisories/GHSA-XWG4-73V4-XW9W)

### New APIs and options

- The CLI now supports --version for displaying the installed nanoid version. (5.1.7) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.7)

### Performance

- Made cusatomAlphabet 75% faster, improving performance for developers using it. (5.1.8) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.8)

### Fixes and other changes

- Fixed random pool corruption on big ID sizes, improving ID generation reliability. (3.3.14, 5.1.15) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.15), [release notes](https://github.com/ai/nanoid/releases/tag/3.3.14)
- Fixed a regression that increased the size of the npm package. (5.1.14) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.14)
- Fixed a breaking issue when requesting a big ID. (3.3.12, 5.1.11) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.11), [release notes](https://github.com/ai/nanoid/releases/tag/3.3.12)
- Fixed nanoid breaking when requesting a big ID. (5.1.10) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.10)
- Type definitions for customRandom were fixed, improving type-checking for users of that API. (5.1.7) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.7)
- The nanoid.js distribution file was updated for CDN use. (5.1.7) — [release notes](https://github.com/ai/nanoid/releases/tag/5.1.7)

## nanoid 3

### Security

- nanoid: custom generators can loop indefinitely when size is zero (3.3.18) — [security advisory](https://github.com/advisories/GHSA-2V37-7H3G-55P8)

### Performance

- Reduced npm package size, which may decrease installation and distribution overhead. (3.3.13) — [release notes](https://github.com/ai/nanoid/releases/tag/3.3.13)

### Fixes and other changes

- Fixed types for developers using nanoid. (3.3.20) — [release notes](https://github.com/ai/nanoid/releases/tag/3.3.20)
- Fixed an issue where setting a huge user ID could kill the app. (3.3.19) — [release notes](https://github.com/ai/nanoid/releases/tag/3.3.19)
- Fixed an infinite loop when the requested size is zero. (3.3.17) — [release notes](https://github.com/ai/nanoid/releases/tag/3.3.17)
