# uuid — card for AI agents

Generate RFC9562 compliant UUIDs for unique identifiers in applications.

Category: Utilities · npm package `uuid` · latest version 14.0.3 (checked 2026-11-01)
Install: `npm install uuid`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (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.

## What it is
- uuid is a JavaScript package for creating UUIDs as defined in RFC9562, formerly RFC4122. The README claims "Support for all RFC9562 UUID versions". Each version it can create has its own function: `v1()` and `v6()` for timestamp UUIDs, `v3()` and `v5()` for namespace UUIDs hashed with MD5 or SHA-1, `v4()` for random UUIDs, and `v7()` for Unix Epoch time-based UUIDs. Other helpers are `parse()`, `stringify()`, `validate()`, `version()`, the `NIL` and `MAX` constants, and converters between v1 and v6.
- The repository was created in 2010 and is MIT licensed. The README lists support for TypeScript, desktop Chrome, Safari, Firefox and Edge, Node, and React Native / Expo. Its Known issues section gives a polyfill for React Native / Expo when the "getRandomValues() not supported" error appears. It says builds are tested against Node LTS releases plus one prior version. For TypeScript, it supports versions released within the past two years. The package also includes a `uuid` command line tool that runs through `npx`.
- You install it with `npm install uuid` and import named functions. The quickstart uses `import { v4 as uuidv4 } from 'uuid'`. Starting with `uuid@12`, the package does not support CommonJS.

## Caveats
- ESM only from v12: Starting with `uuid@12`, 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 `crypto.getRandomValues()` API is not supported. For React Native / Expo, it says to install `react-native-get-random-values` and import it as the very first thing in your entry point.
- Passing options changes timestamp behavior: For `v1()`, `v6()` and `v7()`, the presence of an `options` argument is a flag. With `options`, the internal uniqueness state is not used and defaults are applied instead. This has been the behavior since `uuid@11`.
- No v8 generator: The README says the RFC defines no creation algorithm for experimental v8 UUIDs, so the package has no `v8()` function. `validate()` and `version()` still work with v8 UUIDs.
- Mobile browsers are not tested: The README says builds are tested against the latest desktop Chrome, Safari, Firefox and Edge. Mobile versions of these browsers are expected to work but are not tested.

## Numbers (AgentGid data)
- Gid Score: 80.7 (#87 of all tools, 7 of 408 in its category)
- Used in 297 public projects set up for AI coding agents (4.7%)
- Downloads last week: 401,552,758 (as of 2026-11-24), +34.4% over 4 weeks
- GitHub stars: 15,345 (as of 2026-11-24)
- Last push: 2026-11-01

## Often used with
dotenv 48.1%, Zod 61.6%, TypeScript 86.2%, date-fns 37.4%, React 65.7%, ESLint 69.0%

## Checked alternatives (same job)
- Nanoid (JavaScript): https://agentgid.com/tools/nanoid-npm/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/uuid/
- Homepage: https://github.com/uuidjs/uuid#readme
- Repository: https://github.com/uuidjs/uuid
- Source: https://github.com/uuidjs/uuid#readme
- Source: https://github.com/uuidjs/uuid
- Source: https://github.com/uuidjs/uuid/releases


## uuid: unique IDs for records, files and links

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.

### Where to use 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.

### How to start
- Add the package to your project.

```
npm install uuid
```

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

```
import { v4 as uuidv4 } from 'uuid';

uuidv4(); // ⇨ 'b18794e8-5d0d-417c-b361-ba38e78411b4'
```


### License
Free to use, also in paid and closed-source apps, under the MIT license. If you ship the package's files, keep its short license notice with them.

### Good to know
- Since version 12 it works only with modern import lines; old projects that load packages with require() stay on version 11 or switch.
- Version 14 needs Node.js 20 or newer on a server, because it expects the built-in crypto object.
- Phone browsers are expected to work but are not tested; desktop Chrome, Safari, Firefox and Edge are.
- The project is maintained; release 14.0.3 came out on 9 October 2026.

Checked 2026-11-10 against: https://github.com/uuidjs/uuid/blob/main/README.md, https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md, https://github.com/uuidjs/uuid/blob/main/LICENSE.md, https://registry.npmjs.org/uuid/14.0.3

### Mistakes to avoid
- Don't: const { v4 } = require('uuid') in a CommonJS project → Do: 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.)
- Don't: import uuid from 'uuid'; uuid.v4()  or  require('uuid/v4') → Do: import { v4 as uuidv4 } from 'uuid' (The default export and the per-version deep imports were removed in uuid 8.)
- Don't: Running uuid 14 on Node.js 18 → Do: Use Node.js 20 or newer, or pin uuid@13 (uuid 14 dropped Node 18 and relies on the global crypto object.)
- Don't: Using v3() for new name-based IDs → Do: 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.)
- Don't: Importing uuid first in a React Native app → Do: 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.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
