NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #69 most downloaded on npm
A tiny (118 bytes), secure URL-friendly unique string ID generator
Last release 18 days ago
10 Sep 2026
Release timing varies
gaps range from 8 days to 6 months
Nearly every release is documented
notes for 56 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
133 releases · first in 2017
- Fixed browserify support.
browserify support.Fixed browserify support (by Artur Paikin).
browserify support (by Artur Paikin).- Fixed esbuild support.
esbuild support.One column per quarter.
Added default and browser.default to package.exports.
default and browser.default to package.exports.- Reduced npm package size.
- Fix ES modules support.
Reduced customAlphabet size (by Enrico Scherlies).
customAlphabet size (by Enrico Scherlies).- Fixed package.exports.
package.exports.- Added files without process.
process.Speeded up Nano ID 4 times (by Peter Boyer).
- Fixed package.types path.
package.types path.- Added package.types.
package.types.Removed Node.js 15.0.0 with randomFillSync regression from engines.node.
randomFillSync regression from engines.node.- Improved IE 11 docs.
Fixed asynchronous customAlphabet in browser (by @LoneRifle).
customAlphabet in browser (by @LoneRifle).- Fix ES modules support.
Try to fix React Native Expo support.
- Add React Native Expo support.
- Clean up code.
- Avoid self using.
self using.- Improve IE docs and warning.
Restrict old Node.js 13 by engines.node (by Cansin Yildiz).
engines.node (by Cansin Yildiz).- Fix ES modules issue with CLI.
- Add shebang to CLI.
- Fix CLI.
Nothing published for this version
- Fix docs (by Dylan Irlbeck ).
Fix React Native warning on non-secure import (by Jia Huang).
non-secure import (by Jia Huang).Nano ID 3.0 is the biggest release in the project history. Unfortunately, you will need to change the code of your application. But the changes are ve
Nano ID 3.0 is the biggest release in the project history. Unfortunately, you will need to change the code of your application. But the changes are very small in most cases. In return, you will have better performance, smaller size, ES modules and TypeScript support.
In simple cases, you just need to change default import to named import.
- import nanoid from 'nanoid'
+ import { nanoid } from 'nanoid'
nanoid() //=> "sSAi9F8yakJZPxOCr_WFb"
nanoid(5) //=> "ISe9l"
If you support IE, you need to transpile node_modules by Babel.
Non-secure and asynchronous Nano ID need only import changes as well.
- import nanoid from 'nanoid/non-secure'
+ import { nanoid } from 'nanoid/non-secure'
nanoid() //=> "sSAi9F8yakJZPxOCr_WFb"
- import nanoid from 'nanoid/async'
+ import { nanoid } from 'nanoid/async'
nanoid().then(id => {
id //=> "sSAi9F8yakJZPxOCr_WFb"
})
Remove @types/nanoid if you have it. Nano ID now have built-in types.
npm uninstall @types/nanoid
For Expo you need to load the file by direct path:
- import nanoid from "nanoid/async"
+ import { nanoid } from "nanoid/async/index.native.js"
For the non-Expo environment:
Change polyfill for hardware random generator from expo-random to react-native-get-random-values.
Use sync Nano ID instead of async.
+ import 'react-native-get-random-values'
- import nanoid from 'nanoid/async'
+ import { nanoid } from 'nanoid'
async function createUser () {
const user = new User()
- user.id = await nanoid()
+ user.id = nanoid()
return await user.save()
}
Our default URL-safe alphabet was moved as named export to nanoid path:
- import url from 'nanoid/url'
+ import { urlAlphabet } from 'nanoid'
Now we use the currying API to change the alphabet. It improves performance by pre-calculating some caches for a new alphabet.
We hope the new API will be more readable compare to the old unclear “generate” word.
- import nanoidGenerate from 'nanoid/generate'
+ import { customAlphabet } from 'nanoid'
+ const nanoid = customAlphabet(alphabet, 10)
- nanoidGenerate(alphabet, 10) //=> "0476921501"
+ nanoid() //=> "0476921501"
Non-secure and asynchronous APIs were also changed:
- import nanoidGenerate from 'nanoid/async/generate'
+ import { customAlphabet } from 'nanoid/async'
+ const nanoid = customAlphabet(alphabet, 10)
Custom random generator API now is based on currying as well.
- import nanoidFormat from 'nanoid/format'
- import url from 'nanoid/url'
+ import { customRandom, urlAlphabet } from 'nanoid'
+ const nanoid = customRandom(urlAlphabet, 10, seedRandom)
- nanoidGenerate(seedRandom, url, 10) //=> "sSAi9F8yak"
+ nanoid() //=> "sSAi9F8yak"
We removed a custom random generator from asynchronous API because we didn’t see that somebody used it.
A few good reasons, why you should migrate to Nano ID 3.0:
.d.ts files.id: number = nanoid() // throws Type 'string' is not assignable to type 'number'.
import { nanoid } from 'https://cdn.jsdelivr.net/npm/nanoid/nanoid.js'
Reduce size (by Anton Evzhakov).
Reduce size by 10% (by Anton Khlynovskiy).
Reduce format and async/format size (by Dair Aidarkhanov).
format and async/format size (by Dair Aidarkhanov).Improve React docs (by Nahum Zsilva).
Reduce index, async and non-secure size (by @polemius).
index, async and non-secure size (by @polemius).Reduce size (by Stas Lashmanov).
- Reduce size (by Max Graey). - Fix IE support.
Reduce generate size (by Vsevolod Rodionov).
generate size (by Vsevolod Rodionov).format and format size (by Victor).async, non-secure and non-secure/generate size.format and async/format (by Max Graey).Improve performance (by Stephen Richardson).
- Improve docs.
Fix React Native support (by Shawn Hwei).
Nothing published for this version
Improve error text for React Native (by Sebastian Werner).
Fix freeze on string in ID length.
Improve docs (by Sylvanus Kateile and Mark Stosberg).
Mark package as not having side effects (by @xiaody).
Nothing published for this version
- Reduce non-secure size. - Add async callback type check.
non-secure size.async callback type check.Fix nanoid/async performance regression.
nanoid/async performance regression.not seeded issue in synchronous version too.Fix random generator not seeded issue of old Node.js.
not seeded issue of old Node.js.- Reduce library size.
Nothing published for this version
Reduce library size (by rqrqrqrq).
Fix Node.js 6.11.1 support (by Andrey Belym).
Speed up Node.js secure generators (by Dmitriy Tsvettsikh).
- Fix JSDoc (by Hendry Sadrak).
Fix distribution in nanoid/non-secure (by Eatall).
nanoid/non-secure (by Eatall).- Fix old Node.js support.
Nothing published for this version
Improve performance and reduce size of non-secure ID generator.
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →