alt="Nano ID logo by Anton Lovchikov" width="180" height="94">
A tiny, secure, URL-friendly, unique string ID generator for JavaScript.
```js
var nanoid = require('nanoid')
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B~myT"
```
**Safe.** It uses cryptographically strong random APIs
and guarantees a proper distribution of symbols.
and guarantees a proper distribution of symbols.
**Small.** Only 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_~`)
and has a similar number of unique IDs in just 21 symbols instead of 36.
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"
```
The generator supports Node.js and [all browsers] starting from IE 11.
[all browsers]: http://caniuse.com/#feat=getrandomvalues
[Size Limit]: https://github.com/ai/size-limit
171 unmodified lines
Expand all