Skip to content
faker.tools
All 79

Plate IV · Developer, API & Database Seeding Utilities

UUID, ULID & Nano ID Generator

Eight identifier formats, including time-ordered UUID v7 and ULID, in bulk.

#Identifier
1aebeb47b-4a13-415c-83dc-755f036d8792
2504f72ec-22d0-4b11-8dc4-16b3d853a4e0
3e5494da5-b890-4309-ba87-a0a44e656df0
4f76d4376-3213-41a1-8ef2-79b4855eac03
566055393-5feb-4c9e-ae3e-16f732a09501
60f77c060-a662-4c5c-8376-fc09843d87b9
794fde933-6a8a-443a-835c-2f71689862b1
8bb940548-d0b5-4962-8b41-4660e6891127
97ce9a53a-bd19-452d-b873-5eec5ef52123
109a1958d0-4dd3-44c6-8482-0aa12fe33486
10 rows · 369 BGenerated in your browser · UUID, ULID & Nano ID Generator

A UUID generator produces universally unique identifiers in bulk for fixtures, seed scripts and API mocks. This one covers eight formats — UUID v4, v7 and v1, the nil UUID, ULID, Nano ID, CUID2-style IDs and MongoDB ObjectIds — with options for casing, hyphens and braces, and a column showing the timestamp embedded in the time-ordered formats.

The difference between those formats matters most in databases. UUID v4 is random, so every insert lands in a different page of the primary-key index. UUID v7 and ULID put a timestamp first, so they sort by creation time and insert sequentially. Both are here, and both increase monotonically down a batch.

How to use it

  1. Pick the identifier type.
  2. Choose lowercase or uppercase, and whether to keep hyphens or wrap in braces — the variations different systems store.
  3. For Nano ID, set the length. For v7, ULID and ObjectId, switch on the timestamp column to check ordering at a glance.
  4. Generate as many as you need and copy them as a list, JSON, CSV or SQL.

What you can control

  • UUID v4 (random), v7 (time-ordered) and v1 (timestamp and node), plus the nil UUID.
  • ULID, Nano ID (8–40 characters), CUID2-style IDs and 24-character MongoDB ObjectIds.
  • Lowercase or uppercase; with or without hyphens; optional braces, as in Microsoft GUIDs.
  • The embedded timestamp as its own column for v7, ULID and ObjectId.
  • Time-ordered formats that increase monotonically through the batch.

Choosing a format

Format Length Sortable by time Best for
UUID v4 36 No Opaque public IDs, where creation order should not leak
UUID v7 36 Yes Database primary keys (RFC 9562, 2024)
UUID v1 36 Partly Legacy systems; embeds a MAC-style node ID
ULID 26 Yes Keys that appear in URLs or logs
Nano ID 21 (adjustable) No Short URL-safe IDs
ObjectId 24 Yes (seconds) MongoDB documents

UUID v7 was standardised in RFC 9562 in May 2024, which replaced RFC 4122. PostgreSQL 18 added a built-in uuidv7() function; on older versions, or in application code, a library generates them.

Testing ideas

  • Case sensitivity. Generate uppercase UUIDs and look one up through your API. If the database compares as text, A1B2… and a1b2… may not match.
  • Hyphen-less input. Some clients send 32 hex characters with no hyphens. Decide whether to accept them, and test that decision.
  • Nil UUID. Send 00000000-0000-0000-0000-000000000000 to an endpoint that expects an existing ID. It should be a 404 or a validation error, never a match.
  • Sort order. Insert a batch of v7 IDs in random order and query by ID. They should come back in creation order.
  • Column type. Store a ULID in a native uuid column and see what breaks; it needs converting first.

What this is not

These IDs come from a seeded pseudo-random generator, so they are reproducible and predictable. That is right for fixtures and wrong for anything that must be unguessable. Use crypto.randomUUID() or your database's generator in production.

Questions

Should I use UUID v4 or v7 for a database primary key?

v7, in almost every case. Its first 48 bits are a millisecond timestamp, so new rows land at the end of a B-tree index instead of scattering across it. That keeps inserts fast and indexes compact, while still giving you globally unique, non-sequential-looking IDs.

Are these safe to use as real identifiers?

No. They come from a seeded, deterministic generator so that fixtures are reproducible, which also makes them predictable. In production use crypto.randomUUID(), your database's gen_random_uuid() or uuidv7(), or a maintained UUID library.

What is the difference between a UUID v7 and a ULID?

Both put a 48-bit millisecond timestamp first and randomness after, so both sort by creation time. A UUID v7 is 128 bits in the standard 36-character hyphenated hex form and fits native uuid columns. A ULID is the same size written as 26 characters of Crockford base32, which is shorter and case-insensitive.

What is a nil UUID?

00000000-0000-0000-0000-000000000000 — all 128 bits zero. It is a valid UUID that means 'no value', and it is a useful edge case: plenty of code treats it as a real ID by mistake.

How long should a Nano ID be?

The default 21 characters gives about 126 bits of randomness, comparable to a UUID v4. Shorter IDs are fine for low volumes; the length control runs from 8 to 40 so you can test both short URLs and long tokens.

Next in Developer

All 11 →