alt="Nano ID logo by Anton Lovchikov" width="180" height="94">
A tiny, secure, URL-friendly, unique string ID generator for JavaScript.
**Safe.** It uses cryptographically strong random APIs
and guarantees a proper distribution of symbols.
**Small.** Only 146 bytes (minified and gzipped). No dependencies.
* **Safe.** It uses cryptographically strong random APIs
and tests distribution of symbols.
* **Small.** 146 bytes (minified and gzipped). No dependencies.
It uses [Size Limit] to control size.
* **Compact.** It uses a larger alphabet than UUID (`A-Za-z0-9_~`).
As result it could reduce ID size from 36 to 21 symbols.
**Compact.** It uses a larger alphabet than UUID (`A-Za-z0-9_~`)
and has a similar number of unique IDs in just 21 symbols instead of 36.
```js
var nanoid = require('nanoid')
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B~myT"
```
176 unmodified lines
Expand all