UUID v4 vs UUID v7: Which Should You Use?

Compare random and time-ordered UUIDs, inspect example IDs, and generate a test batch in your browser.

Random IDs or time-ordered IDs?

UUIDv4 uses random bits, with fields reserved for its version and variant. UUIDv7 starts with a Unix timestamp in milliseconds. Its time prefix makes it useful for roughly chronological ordering; it also reveals approximate creation time.

A UUID is an identifier, not an authorization token. Enforce access permissions independently. Neither version is a substitute for a database uniqueness constraint.

Read an example UUID

Both versions use the same 36-character display shape. The first character of the third group identifies the version: 4 or 7. These examples illustrate the layout; generate new values for your own records.

v4: 550e8400-e29b-41d4-a716-446655440000
v7: 0190163d-8c00-7000-8000-000000000001

Try a batch before choosing

Open the UUID generator, select v4 or v7, and generate up to 10,000 IDs. Copy the results or download them as TXT, CSV or JSON for test fixtures. Paste an existing v7 ID into Validate & decode to read its timestamp.

Use v4 when you need random IDs without a time prefix. Consider v7 for records ordered by creation time. Benchmark your database workload: a sortable ID alone does not guarantee faster queries or strict event ordering across machines.

Reference: RFC 9562: UUID versions 4 and 7.