Nano ID
A strong pick. 1st of 9 ID generators.
Nano ID is a tiny, dependency-free, secure generator of short random string IDs that works in browsers, Node.js and React Native. For random IDs in URLs, client state and text keys it is the best pick today. If you need a standard UUID format or keys sorted by time for database indexes, use uuid (v7) or ULID instead.
Best for: Projects that need short, secure, URL-safe random IDs in the browser or on the server, with no dependencies.
Scores
Overall8.5
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
It is the default for short, secure random string IDs in JS. It is well maintained, faster than before and very widely used. It falls short of a universal default because uuid v7 or ULID fit time-sorted database keys and standard formats better. The 2026 advisories call for keeping it up to date.
- npm downloads ratio: 5.3x growth, above the median
- pkgpulse.com/guides/nanoid-vs-uuid-2026: Clear guidance on when to pick nanoid and when to pick uuid
- github.com/ai/nanoid/blob/main/CHANGELOG.md: Active development and quick fixes
GPT-6.2 Sol: 8.5, likely 7.5 to 9.5
Nano ID is a strong pick for compact random IDs because the typed API is small, the package has no runtime dependencies, and maintenance remains active. Choose uuid for UUID interoperability or UUIDv7 ordering. The range reflects uncertainty about direct adoption of 6.x and how broadly release responsibility is shared.
- raw.githubusercontent.com/ai/nanoid/6.0.2/README.md: The stable version documents compact defaults and typed customization.
- github.com/ai/nanoid/releases: Current releases and patches for the older release line.
- github.com/uuidjs/uuid#readme: The closest broad-use peer offers standard UUIDs and time ordering.
- github commitsLastYear and releasesLastYear, dependents, medianDownloadsRatio: Recent maintenance and above-baseline install growth support the recommendation.
Needed by many7.2
How many developers need a tool for this job?
Claude Opus 5.5: 7.5, likely 6.5 to 8.5
Most web apps need unique IDs for records, client state or links. Random short IDs are a large part of that need. Some of it now goes to crypto.randomUUID() or to time-sorted IDs for database keys.
- pkgpulse.com/guides/nanoid-vs-uuid-2026: Recommends nanoid for URLs, text IDs and custom alphabets, and UUID v7/ULID for database keys
- dependents.repos: 1.6M dependent repos, the most in the category
GPT-6.2 Sol: 6.8, likely 5.5 to 8.1
Compact IDs are useful across web front ends, APIs, and distributed back ends. Nano ID serves multiple runtimes without tying projects to a framework. Many projects can use IDs from their database or runtime, and survey data does not measure how many need a compact format.
- 2025.stateofjs.com/en-US/usage/#js_ts_usage: Frontend and backend development are common among respondents.
- raw.githubusercontent.com/ai/nanoid/6.0.2/README.md: Documents browser, Node.js, Deno, and React Native usage.
- developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID: Browsers provide a built-in random UUID generator.
Helps a lot8.6
How well does it do the job for those who need it?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
Nano ID does its job very well. It is small and fast, has good types (including opaque types) and lets you set the alphabet and length. It does not make time-sorted or standard-format IDs, and that is a real limit for database keys. Several size-argument edge-case bugs were found and fixed this year.
- github.com/ai/nanoid/blob/main/CHANGELOG.md: 6.0 is 4x faster, plus fixes for size edge cases and opaque types
- dev.to/farasat6346138/uuid-vs-ulid-vs-nanoid-which-identifier-should-you-use-in-2026-3ffk: Small and URL-safe, but not sortable and not a standard format
- npm hasTypes / dependencies: Ships types and has zero dependencies
GPT-6.2 Sol: 8.7, likely 7.7 to 9.7
The one-call default produces 126 random bits in 21 characters, and the typed API has clear examples for custom formats. Version 6.0.2 is fast in Node benchmarks, with results that vary by workload and benchmark harness. The uuid package is a better fit for standard UUIDs and time-ordered UUIDv7.
- raw.githubusercontent.com/ai/nanoid/6.0.2/README.md: Documents entropy, custom generators, branded types, and the project's benchmarks.
- github.com/orhanayd/nope-id#performance: A competing generator's Node 26 benchmark measures about 26 million default Nano IDs per second.
- github.com/uuidjs/uuid#readme: The peer supports RFC-compliant UUIDs, including version 7.
Holds up over time8.3
Will it still be a good choice in two years?
Claude Opus 5.5: 8.5, likely 7.5 to 9.5
The repo is active: 139 commits and 22 releases in the last year, no open issues, and 160 contributors. Andrey Sitnik leads it, and he also maintains PostCSS, which depends on Nano ID, so the project is tied to core tooling. The main risk is that it rests on one lead maintainer. Its major versions also drop Node.js versions often.
- github commitsLastYear / releasesLastYear: 139 commits and 22 releases in the last year
- github openIssues: 0 open issues and 270 closed
- github.com/ai/nanoid/blob/main/CHANGELOG.md: 6.0 dropped Node 18 and 20, and 5.0 removed the async API
GPT-6.2 Sol: 8.0, likely 6.9 to 9.1
Nano ID had 139 commits and 22 releases in the past year, including fixes on the older 3.x line. The release tags reviewed were signed by the same maintainer, and the full publisher count and funding level are unclear. Recent maintenance is active, though the v6 runtime change adds upgrade work for teams on older Node versions.
- github commitsLastYear, releasesLastYear, openPullRequests: 139 commits, 22 releases, and one open pull request.
- github.com/ai/nanoid/releases: Multiple contributors land fixes, with releases signed by the same maintainer.
- github.com/ai/nanoid/issues/605: A user reported a 3.x hang and received a same-day initial backport.
- github.com/ai/nanoid/releases/tag/6.0.0: Version 6 dropped Node.js 18 and 20.
- evilmartians.com/services/npm-release-hardening: Evil Martians identifies its principal frontend engineer as the maintainer.
Used widely8.8
How many use it, and is that growing?
Claude Opus 5.5: 9.0, likely 8.0 to 9.5
About 1.5B downloads in 4 weeks, 5.3x the same weeks a year ago and above the 4.1 median. Much of that comes through PostCSS and other tools that install it. Even so, 1.6M dependent repos is more than uuid's 1.0M, which shows heavy direct use.
- npm downloadsLast4Weeks: 1.50B now against 283M a year ago, a ratio of 5.3
- dependents.repos: 1,618,762 repos against 1,006,437 for uuid
- github stars: 27k stars, the most in the category
GPT-6.2 Sol: 8.6, likely 7.4 to 9.6
Ecosyste.ms found 1.62 million dependent repositories and 7,827 dependent packages, ahead of the peer repository counts in the bundle. Four-week downloads rose 5.3× year over year, above the 4.1× catalog baseline and uuid's 2.3× growth. Repeat installs and transitive use through projects such as PostCSS make it hard to estimate how many teams are choosing Nano ID directly today.
- dependents repos and packages, peers dependentRepos: Nano ID leads the bundle's tracked repository counts, ahead of uuid at 1.01 million.
- npm downloadsLast4Weeks, downloadsSame4WeeksYearAgo, medianDownloadsRatio, peers uuid: 1.50 billion versus 283 million downloads, or 5.3× growth against a 4.1× baseline.
- github.com/postcss/postcss/blob/main/package.json: PostCSS pulls in the Nano ID 3.x line.
Vouched for7.7
Who stands behind it being good?
Claude Opus 5.5: 7.5, likely 6.5 to 8.5
Major tools such as PostCSS, Vite's toolchain and many frameworks depend on it, so it runs in production at a very large scale. Independent comparison guides recommend it for short URL-safe IDs. There is no survey data specific to ID generators.
- pkgpulse.com/guides/nanoid-vs-uuid-2026: Independent guide that recommends nanoid for short IDs
- dev.to/farasat6346138/uuid-vs-ulid-vs-nanoid-which-identifier-should-you-use-in-2026-3ffk: 2026 comparison that recommends it for front-end apps
- PostCSS and other build tools depend on nanoid: Built into core tooling
GPT-6.2 Sol: 7.8, likely 6.7 to 9.0
Cloudflare's AI Chat package depends on Nano ID, and Redux Toolkit uses an inlined non-secure copy for request IDs. Independent benchmark authors have measured high throughput for compact IDs on their own setups. The visible integrations mostly validate earlier releases or copied code, and direct evidence of satisfaction with 6.x is limited.
- github.com/cloudflare/agents/blob/main/packages/ai-chat/package.json: Cloudflare's AI Chat package declares Nano ID 5.x as a dependency.
- redux.js.org/toolkit/api/other-exports: Redux Toolkit documents its inlined non-secure generator.
- dev.to/spmaxwell7/i-built-a-unique-id-generator-thats-60-faster-than-nanoid-1aan: The developer of jet-id reports high Nano ID throughput on a separate benchmark setup.
Safe7.4
How safe is it to depend on?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
MIT licence, zero dependencies, and npm provenance with staged publishing. Four advisories came in the last 24 months, including the HIGH CVE-2026-73086, where a huge size value corrupts the random pool. All four were patched, also on the 3.x and 5.x lines, and they need size values controlled by an attacker. The Scorecard is 6.5, with weak code-review and branch-protection checks.
- advisories: 5 in total, 4 in the last 24 months, 3 of them HIGH in 2026
- osv.dev/GHSA-xwg4-73v4-xw9w: Integer overflow, fixed in 3.3.12 and 5.1.11
- scorecard: 6.5 overall, Code-Review 3, Branch-Protection 0
- npm dependencies: Zero dependencies
GPT-6.2 Sol: 7.8, likely 6.7 to 8.9
Nano ID has zero runtime dependencies and a permissive MIT license. The three high-severity 2026 advisories cover earlier releases and have fixes on the 3.x and 5.x lines. Version 6.0.2 has a verified Git tag and is built through a staged npm publishing workflow. Weak code-review, branch-protection, and fuzzing scores leave uncertainty about how reliably future bugs will be caught.
- npm dependencies and license, scorecard checks: Zero runtime dependencies and MIT, with Scorecard 6.5, code review 3, and branch protection and fuzzing both 0.
- github.com/advisories/GHSA-xwg4-73v4-xw9w: The random-pool overflow advisory lists patched 3.x and 5.x releases.
- github.com/advisories/GHSA-28wg-ghj8-5hjv: The non-secure generator hang has fixes on both older lines.
- github.com/advisories/GHSA-2v37-7h3g-55p8: The custom-generator hang has fixes on both older lines.
- github.com/ai/nanoid/blob/6.0.2/.github/workflows/release.yml: The release workflow pins its GitHub Actions and stages npm publication.
- github.com/ai/nanoid/releases/tag/6.0.2: GitHub marks the release immutable and the tag signature verified.
Good
- Zero dependencies and a bundle of about 118 bytes, so it costs almost nothing in front-end builds.
- Uses a secure random source, and the default 21-character ID holds about 126 bits of entropy.
- customAlphabet and customRandom let you choose the length and the character set, for example numeric-only codes.
- Actively maintained: 6.0 is about 4x faster, ships with types, and is published with npm provenance.
Bad
- IDs are not sorted by time, so as database primary keys they index worse than UUID v7 or ULID.
- The format is not a standard, so Postgres uuid columns and APIs that expect a UUID need the uuid package instead.
- In 2026 several advisories about the size argument (infinite loops, random pool corruption) needed patch upgrades.
- Major versions drop old Node.js lines and APIs: 6.0 removed Node 18 and 20, and 5.0 removed the async API.
The numbers
- npm downloads, 4 weeks
- 1.5B ×5.3 in a year
- GitHub stars
- 27k
- Commits, 12 months
- 139
- npm version
- 6.0.2 Oct 2026
- Versions, 12 months
- 22
- Advisories, 24 months
- 4 of 5 ever
- OpenSSF Scorecard
- 6.5 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (ai/nanoid), npm (nanoid), OSV and the OpenSSF Scorecard.