nanoid

A tiny (118 bytes), secure URL-friendly unique string ID generator

MIT 123 个版本
安装
npm install nanoid
yarn add nanoid
pnpm add nanoid
bun add nanoid
README

Nano ID

Nano ID logo by Anton Lovchikov

English | 日本語 | Русский | 简体中文 | Bahasa Indonesia | 한국어 | العربية

A tiny, secure, URL-friendly, unique string ID generator for JavaScript.

“An amazing level of senseless perfectionism, which is simply impossible not to respect.”

  • Small. 118 bytes (minified and brotlied). No dependencies. Size Limit controls the size.
  • Safe. It uses hardware random generator. Can be used in clusters.
  • Short IDs. It uses a larger alphabet than UUID (A-Za-z0-9_-). So ID size was reduced from 36 to 21 symbols.
  • Portable. Nano ID was ported to over 20 programming languages.
import { nanoid } from 'nanoid'
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"

  Made at Evil Martians, product consulting for developer tools.


版本列表
5.1.14 2026-06-18
5.1.13 2026-06-18
5.1.12 2026-06-18
5.1.11 2026-04-30
5.1.10 2026-04-30
5.1.9 2026-04-15
5.1.8 2026-04-15
5.1.7 2026-03-15
5.1.6 2025-09-22
5.1.5 2025-03-18
5.1.4 2025-03-15
5.1.3 2025-03-07
5.1.2 2025-02-22
5.1.1 2025-02-22
5.1.0 2025-02-14
5.0.9 2024-11-26
5.0.8 2024-10-28
5.0.7 2024-04-07
5.0.6 2024-02-20
5.0.5 2024-02-01
5.0.4 2023-12-02
5.0.3 2023-11-06
5.0.2 2023-10-15
5.0.1 2023-09-12
5.0.0 2023-09-12
4.0.2 2023-03-26
4.0.1 2023-02-05
4.0.0 2022-06-08
3.3.13 2026-06-18
3.3.12 2026-04-30
3.3.11 2025-03-18
3.3.10 2025-03-15
3.3.9 2025-03-07
3.3.8 2024-11-26
3.3.7 2023-11-06
3.3.6 2023-03-26
3.3.5 2023-03-26
3.3.4 2022-05-03
3.3.3 2022-04-18
3.3.2 2022-03-28
3.3.1 2022-02-16
3.3.0 2022-02-14
3.2.0 2022-01-16
3.1.32 2022-01-12
3.1.31 2022-01-11
3.1.30 2021-10-13
3.1.29 2021-10-05
3.1.28 2021-09-26
3.1.27 2021-09-26
3.1.26 2021-09-26
3.1.25 2021-08-12
3.1.24 2021-08-11
3.1.23 2021-05-10
3.1.22 2021-03-15
3.1.21 2021-03-11
3.1.20 2020-12-01
3.1.19 2020-12-01
3.1.18 2020-11-20
3.1.17 2020-11-20
3.1.16 2020-10-26
3.1.15 2020-10-23
3.1.14 2020-10-23
3.1.13 2020-10-21
3.1.12 2020-07-29
3.1.11 2020-07-27
3.1.10 2020-06-13
3.1.9 2020-05-17
3.1.8 2020-05-16
3.1.7 2020-05-11
3.1.6 2020-05-08
3.1.5 2020-05-05
3.1.4 2020-05-04
3.1.3 2020-04-10
3.1.2 2020-04-10
3.1.1 2020-04-10
3.1.0 2020-04-10
3.0.2 2020-03-29
3.0.1 2020-03-28
3.0.0 2020-03-26
2.1.11 2020-01-30
2.1.10 2020-01-22
2.1.9 2020-01-07
2.1.8 2019-12-14
2.1.7 2019-11-16
2.1.6 2019-10-24
2.1.5 2019-10-23
2.1.4 2019-10-17
2.1.3 2019-10-11
2.1.2 2019-10-03
2.1.1 2019-09-11
2.1.0 2019-08-30
2.0.4 2019-08-25
2.0.3 2019-05-21
2.0.2 2019-05-16
2.0.1 2019-01-14
2.0.0 2018-11-04
1.3.4 2018-11-04
1.3.3 2018-10-31
1.3.2 2018-10-31
1.3.1 2018-10-20
1.3.0 2018-10-12
1.2.6 2018-10-02
1.2.5 2018-09-29
1.2.4 2018-09-26
1.2.3 2018-09-04
1.2.2 2018-08-28
1.2.1 2018-08-16
1.2.0 2018-08-10
1.1.1 2018-08-08
1.1.0 2018-07-14
1.0.7 2018-07-08
1.0.6 2018-07-08
1.0.5 2018-07-06
1.0.4 2018-06-22
1.0.3 2018-06-04
1.0.2 2018-02-13
1.0.1 2017-10-30
1.0.0 2017-10-22
0.2.2 2017-10-10
0.2.1 2017-09-16
0.2.0 2017-08-10
0.1.1 2017-08-09
0.1.0 2017-08-06