1. License
“to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”
MIT allows use in paid and closed-source products.
github.com/uuidjs/uuid/blob/main/LICENSE.md3. Used by agents' projects
Dependency in 297 public GitHub projects set up for AI coding agents that we scanned (4.7%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What uuid does
uuid is a small free JavaScript package that makes UUIDs, long codes like 109156be-c4fb-41ea-b1b4-efe1671c5836. Your app can give every order, upload or message its own ID on the spot, without asking a database for the next number. It works in the browser and on a server, and it brings no other packages with it.
What people build with it
Random IDs for new orders
Each new order, upload or chat message gets an ID the moment it is made, even before it reaches your database.
IDs that sort by creation time
Rows in a table or files in a folder line up in the order they were made when you sort them by ID.
The same name always gets the same ID
Importing the same web page or product twice gives it the same ID, so you can spot the copy instead of storing it twice.
Check IDs that arrive in links
Before you look up /orders/<id>, make sure the part after the slash really is an ID of the kind your app makes.
IDs in a phone app
A React Native or Expo app makes IDs on the phone, offline, after one extra small package is loaded first.
uuid popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How uuid is used
- uuid is a dependency in 297 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (6.1% of the 4,867 JavaScript/TypeScript ones), #4 of 408 in utilities.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,082; those are left out of every share on this page.
- The most used alternative in our scan is Nanoid (JavaScript) (104 projects).
- Projects that use it most often also use dotenv (48.1%), Zod (61.6%), TypeScript (86.2%).
- It is more common in projects set up for Roo Code (12.6%) than for OpenAI Codex (3.0%).
By coding agent
Often used with
uuid in practice
Strengths
The README describes the package as zero-dependency and tree-shakable. It says random values come from the modern <code>crypto</code> API.
<code>v7()</code> accepts an <code>options.seq</code> value. The README says you can provide it to help keep UUIDs unique when several are created in the same millisecond.
<code>validate()</code> returns true or false. <code>version()</code> returns the RFC version number. The README shows the two used together to accept only v4 UUIDs.
The generators take an optional <code>buffer</code> and <code>offset</code>. If you pass a buffer, the function writes the binary UUID into it and returns the buffer instead of a string.
Watch out for
Starting with <code>uuid@12</code>, CommonJS is not supported. The README links to notes on the implications and the reasons for the change.
The README says a "getRandomValues() not supported" error occurs in environments where the standard <code>crypto.getRandomValues()</code> API is not supported. For React Native / Expo, it says to install <code>react-native-get-random-values</code> and import it as the very first thing in your entry point.
For <code>v1()</code>, <code>v6()</code> and <code>v7()</code>, the presence of an <code>options</code> argument is a flag. With <code>options</code>, the internal uniqueness state is not used and defaults are applied instead. This has been the behavior since <code>uuid@11</code>.
Accept only v4 UUIDs
import { version as uuidVersion } from 'uuid';
import { validate as uuidValidate } from 'uuid';
function uuidValidateV4(uuid) {
return uuidValidate(uuid) && uuidVersion(uuid) === 4;
}
const v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210';
const v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836';
uuidValidateV4(v4Uuid); // ⇨ true
uuidValidateV4(v1Uuid); // ⇨ falseMore about uuid
Funding
- GitHub Sponsors: https://github.com/broofa
- GitHub Sponsors: https://github.com/ctavan
- 4 GitHub sponsors
Head to head
- uuid vs Nanoid (JavaScript) used together in 21 projects
Packages around it
- zod: Schema validation
- typescript: Typed JavaScript
- dotenv: Env file loader
- date-fns: Date utilities
- eslint: JavaScript linter
- express: Node web framework
Alternatives
uuid This page
Pick Nano ID when you want short IDs for links and do not need the standard UUID format.
Pick ULID when you want IDs that sort by time and are shorter as text than a UUID.
Pick uuidv7 when the only kind you need is the time-ordered version 7.
Get started
Tell your AI assistant
“Use the npm package uuid (pin uuid@14.0.3, ES module imports, Node 20 or newer) to give every new order a v7() ID, and check IDs that come in through links with validate() and version().”
Import the kind of ID you need by name and call it.
import { v4 as uuidv4 } from 'uuid'; uuidv4(); // ⇨ 'b18794e8-5d0d-417c-b361-ba38e78411b4'
Rules for your agent
## uuid
- Use ESM named imports such as `import { v4 as uuidv4 } from 'uuid'`. CommonJS is not supported from `uuid@12`.
- In React Native / Expo, install `react-native-get-random-values` and put `import 'react-native-get-random-values'` as the very first import in the entry point.
- For `v1()`, `v6()` and `v7()`, passing any `options` argument means the internal uniqueness state is not used. Calling them without `options` keeps that internal state in use.
- For namespace UUIDs, the README quotes the RFC: if backward compatibility is not an issue, prefer `v5()` (SHA-1) over `v3()` (MD5). Use `v5.URL` or `v5.DNS` for the RFC namespaces.
- `parse()` and `version()` throw `TypeError` if the string is not a valid UUID, and `stringify()` throws `TypeError` if a valid UUID string cannot be generated. `validate()` returns `true` or `false` instead.
- Do not call `v8()`. The package does not offer it, though `validate()` and `version()` work with v8 UUIDs.
Mistakes to avoid
uuid 12 and later ship only ES modules.
The default export and the per-version deep imports were removed in uuid 8.
uuid 14 dropped Node 18 and relies on the global crypto object.
v3 uses MD5; the README quotes the standard that SHA-1 (version 5) is preferred.
Without it the app fails with "getRandomValues() not supported".
Questions
Can I use it in a paid, closed-source app?
Yes. It is MIT-licensed; keep the license notice if you ship its files.
Which kind of UUID should I use?
v4 for plain random IDs, v7 when IDs should sort by the time they were made, and v5 when the same name must always give the same ID.
Why does require('uuid') or import uuid from 'uuid' not work?
Version 12 dropped CommonJS, and there has been no default export since version 8. Use named imports such as import { v4 as uuidv4 } from 'uuid'.
Can it make version 8 UUIDs?
No. The standard gives no recipe for them, so the package has no v8() function; validate() and version() still accept them.
Can I make an ID in the terminal?
Yes, the package includes a small command; npx uuid prints a version 4 ID.