Menu

1 / 2

UUID v4 vs UUID v7: Which One Should You Use?

DEV Community·Snappy Tools·6 months ago
#Ms09Ojqw
#uuid#webdev#beginners#random#database
Reading 0:00
15s threshold

If you've worked with UUIDs, you've almost certainly used UUID v4 — the random, hexadecimal string that looks like 550e8400-e29b-41d4-a716-446655440000 . It's everywhere: database primary keys, API identifiers, session tokens.

But there's a newer format gaining traction: UUID v7 . It solves a real problem with v4 that trips up developers at scale.

Here's what you need to know.

Quick refresher: What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit value used to identify something without a central authority. The format is always the same — 32 hexadecimal characters in 5 groups separated by hyphens: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx .

The M position indicates the version . The N position indicates the variant .

UUID v4 — The random one

UUID v4 uses 122 bits of cryptographically random data.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.