Developer UUID tools

Node UUID Generator

Generate UUIDs for Node.js services, scripts, tests, queues, and database records, then review the built-in and npm package approaches.

Node UUID generator

Create UUID values in the browser for Node.js examples, fixtures, request IDs, and migrations.

123e4567-e89b-42d3-a456-426614174000
123e4567-e89b-42d3-a456-426614174001
123e4567-e89b-42d3-a456-426614174002
123e4567-e89b-42d3-a456-426614174003
123e4567-e89b-42d3-a456-426614174004
123e4567-e89b-42d3-a456-426614174005
123e4567-e89b-42d3-a456-426614174006
123e4567-e89b-42d3-a456-426614174007
123e4567-e89b-42d3-a456-426614174008
123e4567-e89b-42d3-a456-426614174009
Output options

Generate 1 to 1000 IDs per batch.

Generated values stay in your browser. This page does not send UUIDs or GUIDs to a server for generation.

Node.js crypto.randomUUID examples

Current Node.js versions include crypto.randomUUID() for UUID v4 generation. Use it when you only need random UUIDs and do not need package-specific features.

CommonJS
const { randomUUID } = require("node:crypto");

const id = randomUUID();
console.log(id);
ESM
import { randomUUID } from "node:crypto";

const id = randomUUID();
console.log(id);

npm uuid package note

The npm uuid package is useful when you need versions such as UUID v7, consistent imports across environments, or a library API used across a larger codebase.

Install uuid from npm
npm install uuid

Generate one UUID

Use randomUUID() for one Node UUID at a time. Store it as a string unless your database has a native UUID column type.

Generate multiple UUIDs

For batches, map over an array or loop the count you need. Avoid generating more IDs than your script needs in memory.

Generate multiple UUIDs in Node
import { randomUUID } from "node:crypto";

const ids = Array.from({ length: 10 }, () => randomUUID());
console.log(ids);

Common Node UUID mistakes

Do not use Math.random() for UUID generation. Do not install a package if crypto.randomUUID() fully covers your use case. Do not log IDs together with private request payloads.

FAQ

How do I generate a UUID in Node.js?+

Use randomUUID from node:crypto for a built-in UUID v4 string.

Do I need the npm uuid package in Node?+

Not for basic UUID v4 generation. Use the package when you need UUID v7 or a shared library API.

Can Node generate UUIDs without a server dependency?+

Yes. crypto.randomUUID() is built into Node and does not require a remote service.