nanoid
npmv6.0.1TypeScriptA tiny (118 bytes), secure URL-friendly unique string ID generator
Safe to adopt
Yes — nanoid scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 37 days ago. 32 releases in the last 2 years.
- ?Adoption: grade ?, Not reported by this registry.
No download data reported for this package yet.
- AMaintenance: grade A, Excellent.
Last published 37 days ago. 32 releases in the last 2 years.
- AWeight: grade A, Excellent.
Zero runtime dependencies, about 14 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding nanoid to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Compatibility
- Node.js
- node ^22 || ^24 || >=26
- Module format
- ESM only
- TypeScript
- Types included
- Install scripts
- None
Quick start
A usage example from the nanoid README.
import { nanoid } from 'nanoid'
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"nanoid vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| nanoidthis page | 0 | 3 | MIT | 1 month ago |
| uuid | 254.8M | 8 | MIT | 1 day ago |
| tr46 | 192.6M | 1 | MIT | 1 day ago |
| @jridgewell/resolve-uri | 166.3M | 1 | MIT | 1 day ago |
| punycode | 148.9M | 2 | MIT | 1 day ago |
| encodeurl | 133.6M | 5 | MIT | 1 day ago |
Used by
Popular packages that depend on nanoid.
Relationship graph
Dependencies (left) and dependents (right) of nanoid.
Frequently installed together
Native navigation primitives for your React Native app.
The Expo SDK
More powerful alternative to Animated library for React Native.
Simple and complete React Native testing utilities that encourage good testing practices.
Declarative API exposing native platform touch and gesture system to React Native
React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.
Tools for making advanced Metro bundler features work
Error overlay for universal Expo apps.
React Native for Web
TypeScript definitions for node
Escape RegExp special characters
React is a JavaScript library for building user interfaces.
Release history
29 releases in the last two years, typically about 1 day apart.
| Version | Published | Size | License |
|---|---|---|---|
| 3.3.18 | 1 month ago | 25 KB | MIT |
| 6.0.1latest | 1 month ago | 14 KB | MIT |
| 3.3.17 | 1 month ago | 24 KB | MIT |
| 6.0.0 | 1 month ago | 14 KB | MIT |
| 3.3.16 | 1 month ago | 24 KB | MIT |
| 5.1.16 | 2 months ago | 13 KB | MIT |
| 3.3.15 | 2 months ago | 24 KB | MIT |
| 5.1.15 | 2 months ago | 13 KB | MIT |
| 3.3.14 | 2 months ago | 32 KB | MIT |
| 5.1.14 | 2 months ago | 13 KB | MIT |
| 5.1.13 | 2 months ago | 30 KB | MIT |
| 5.1.12 | 2 months ago | 30 KB | MIT |
| 3.3.13 | 2 months ago | 32 KB | MIT |
| 5.1.11 | 4 months ago | 13 KB | MIT |
| 3.3.12 | 4 months ago | 32 KB | MIT |
Overview
nanoid is an npm package that a tiny (118 bytes), secure URL-friendly unique string ID generator. It has 3 known dependents in the graph. The latest version is 6.0.1, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need a tiny (118 bytes), secure URL-friendly unique string ID generator and value a focused solution.
When not to use it
Consider an alternative if you need to or if a more actively-maintained option better fits your npm stack.
Pros
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
- Zero runtime dependencies — minimal footprint.
Cons
- No significant drawbacks detected from available metadata.
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Funding
Frequently asked questions
Should I use nanoid?
Yes — nanoid scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 37 days ago. 32 releases in the last 2 years.
How do I install nanoid?
Run `npm install nanoid` to add nanoid to your npm project.
What license is nanoid released under?
nanoid is distributed under the MIT license.
How popular is nanoid?
npm does not publish download counts. Within PackageGraph's crawl, 3 known packages depend on nanoid.
Is nanoid still maintained?
The most recent release of nanoid (v6.0.1) was published 1 month ago.
Does nanoid run install scripts?
No. nanoid does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.