nanoid
A tiny (118 bytes), secure, URL-friendly, unique string ID generator for JavaScript
Nano ID generates tiny, unique random IDs for your app, a modern, URL-safe alternative to UUID that is 40% shorter, cryptographically secure, and weighs just 118 bytes.
Nano ID is a tiny JavaScript tool that generates unique random IDs — short strings of letters and numbers used to tell things apart in software. Think of it like a digital fingerprint generator: every time you call it, you get a unique code like "V1StGXR8_Z5jdHi6B-myT" that you can use to identify a record, a user, an item, or anything else in your app.
It's essentially a modern, leaner alternative to UUID — a format developers have used for decades to create unique identifiers. Nano IDs are 21 characters long compared to UUID's 36, which means shorter URLs and less storage space, while still being statistically unique enough that you'd need to generate 103 trillion of them before the odds of a duplicate reached even one in a billion.
The key selling points for developers using it in their projects: it's extremely small (118 bytes — practically no impact on app load time), it uses cryptographically secure randomness (meaning the IDs can't be predicted or guessed), and the generated IDs use only URL-safe characters so they work cleanly in web addresses without needing encoding.
For someone building an app with Lovable, Bolt, or Cursor — anywhere you need to give things unique IDs, like database records, order numbers, session tokens, or short shareable links — Nano ID is a popular, battle-tested choice that many major JavaScript projects depend on. It has been ported to over 20 programming languages, so you're not locked into JavaScript if your project grows.
Where it fits
- Generate unique IDs for database records, user accounts, or orders in any JavaScript app
- Create short shareable links or session tokens that are URL-safe and hard to predict
- Replace UUID in your project to get 40% shorter identifiers without sacrificing uniqueness