Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

uuid

Unique IDs for records, files and links.

UtilitiesNPM

GitHubWebsite

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.md

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

81 / 100
Gid Score, #87 overall
402M
downloads a week, npm
15.3K
GitHub stars
297
agent projects use it
uuid: downloads per weeknpm, uuid 401,552,758
uuid: GitHub starsuuidjs/uuid 15,345

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

164 projects, 6.7%
157 projects, 4.8%
138 projects, 4.5%
27 projects, 5.7%
22 projects, 7.9%
17 projects, 12.1%
14 projects, 12.6%
14 projects, 3.0%

Often used with

In 48.1% of its projects
In 61.6% of its projects
In 86.2% of its projects
In 37.4% of its projects
In 65.7% of its projects
In 69.0% of its projects
In 32.3% of its projects
In 29.3% of its projects

uuid in practice

Strengths

No dependencies, and randomness comes from crypto

The README describes the package as zero-dependency and tree-shakable. It says random values come from the modern <code>crypto</code> API.

v7 has a sequence counter you can set

<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.

Per-version validation

<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.

Writes binary UUIDs into a buffer

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

ESM only from v12

Starting with <code>uuid@12</code>, CommonJS is not supported. The README links to notes on the implications and the reasons for the change.

React Native needs a polyfill, imported first

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.

Passing options changes timestamp behavior

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); // ⇨ false

More about uuid

Funding
  • GitHub Sponsors: https://github.com/broofa
  • GitHub Sponsors: https://github.com/ctavan
  • 4 GitHub sponsors

See all

Head to head
Packages around it
  • zod: Schema validation
  • typescript: Typed JavaScript
  • dotenv: Env file loader
  • date-fns: Date utilities
  • eslint: JavaScript linter
  • express: Node web framework
More in Utilities

Alternatives

uuid This page

MITGid 81402M/wk

Nanoid (JavaScript)

Pick Nano ID when you want short IDs for links and do not need the standard UUID format.

MITGid 81399M/wk

ULID

Pick ULID when you want IDs that sort by time and are shorter as text than a UUID.

uuidv7

Pick uuidv7 when the only kind you need is the time-ordered version 7.

Compare uuid with another tool

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().”

  1. Add the package to your project.

    npm install uuid

    From github.com/uuidjs/uuid/blob/main/README.md

  2. Import the kind of ID you need by name and call it.

    import { v4 as uuidv4 } from 'uuid';
    
    uuidv4(); // ⇨ 'b18794e8-5d0d-417c-b361-ba38e78411b4'
    

    From github.com/uuidjs/uuid/blob/main/README.md

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## 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

const { v4 } = require('uuid') in a CommonJS project
import { v4 as uuidv4 } from 'uuid' in an ES module project, or pin uuid@11 where only require() is possible

uuid 12 and later ship only ES modules.

import uuid from 'uuid'; uuid.v4() or require('uuid/v4')
import { v4 as uuidv4 } from 'uuid'

The default export and the per-version deep imports were removed in uuid 8.

Running uuid 14 on Node.js 18
Use Node.js 20 or newer, or pin uuid@13

uuid 14 dropped Node 18 and relies on the global crypto object.

Using v3() for new name-based IDs
Use v5() with your own namespace UUID or v5.URL / v5.DNS

v3 uses MD5; the README quotes the standard that SHA-1 (version 5) is preferred.

Importing uuid first in a React Native app
import 'react-native-get-random-values' as the very first line of the entry file, then uuid

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.