Pulsars

UUID Generator — v4 & v7 Online

Generated 0 UUIDs

A UUID (Universally Unique Identifier) is a 128-bit identifier standardized in RFC 9562 (2024, replacing RFC 4122). UUIDv4, the most common version, generates 122 random bits — producing 5.3 x 10^36 possible values, making collision probability negligible even at billions of generated IDs. UUIDv7 (2024) embeds a Unix timestamp in the first 48 bits, making UUIDs sortable by creation time — ideal for database primary keys where insertion order matters for index performance.

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit label used to identify information across distributed systems without requiring a central coordinating authority. The standard text representation is 32 hexadecimal digits in five dash-separated groups: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. UUIDs are defined by RFC 4122 (original) and RFC 9562 (2024 update that introduced v7).

The version digit (the 13th hex character) tells you how the UUID was generated. Version 4 means random, version 7 means timestamp-based. The variant bits (positions 17-18) indicate the UUID conforms to the RFC standard.

What is the difference between UUID v4 and v7?

UUID v4 fills 122 of its 128 bits with cryptographically secure random data (the remaining 6 bits encode the version and variant). This gives 5.3 × 10³⁶ possible values, making collisions astronomically unlikely. V4 is the most widely used version today.

UUID v7, defined in RFC 9562 (2024), embeds a Unix millisecond timestamp in the first 48 bits. The remaining bits are random (with version and variant markers). This means v7 UUIDs are naturally sortable by creation time — a huge benefit for database primary keys, since B-tree indexes perform best with sequential inserts. PostgreSQL, MySQL, CockroachDB, and most modern databases benefit significantly from ordered IDs.

In short: use v4 for maximum randomness and zero information leakage. Use v7 when you want time-sortable, index-friendly identifiers.

When should you use UUIDs?

UUIDs are the standard choice whenever you need globally unique identifiers without a central ID authority:

Need to encode your UUIDs for transport? Try our Base64 encoder.

Frequently Asked Questions

What is a UUID?

+

A UUID (Universally Unique Identifier) is a 128-bit value standardized by RFC 4122 and RFC 9562, used to uniquely identify resources across distributed systems without a central authority. The standard representation is 32 hexadecimal digits displayed in five groups separated by dashes (8-4-4-4-12), for example 550e8400-e29b-41d4-a716-446655440000. UUIDs are widely used as database primary keys, API resource identifiers, session tokens, and correlation IDs in microservice architectures.

What is the difference between UUID v4 and v7?

+

UUID v4 generates identifiers using 122 cryptographically random bits, making each value essentially unpredictable and statistically unique. UUID v7, introduced in RFC 9562 (2024), encodes a Unix millisecond timestamp in the first 48 bits, followed by random data. This means v7 UUIDs are naturally sortable by creation time — a major advantage for database indexing, since sequential IDs reduce B-tree page splits and improve write performance. Use v4 when you need pure randomness with no embedded information, and v7 when time-ordered identifiers benefit your architecture.

Are UUIDs truly unique?

+

For all practical purposes, yes. UUID v4 draws from a space of 2¹²² possible values (approximately 5.3 × 10³⁶). To have a 50% chance of a single collision, you would need to generate around 2.7 × 10¹⁸ UUIDs — that's 2.7 quintillion. At a rate of one billion UUIDs per second, it would take over 85 years to reach that threshold. UUID v7 further reduces collision risk by incorporating a millisecond timestamp, ensuring that IDs generated at different times are inherently different. In practice, UUID collisions are far less likely than hardware failures.

Is UUID the same as GUID?

+

Yes, GUID (Globally Unique Identifier) is the term Microsoft adopted for the same concept. GUIDs and UUIDs follow identical formats and generation algorithms as defined in RFC 4122. The only historical difference is that some Microsoft tools display GUIDs with curly braces (e.g., {550e8400-e29b-41d4-a716-446655440000}), but the underlying 128-bit value is exactly the same. The terms UUID and GUID are fully interchangeable in modern software development.

When should I use UUID v7 instead of v4?

+

Choose UUID v7 when your use case benefits from time-ordered identifiers. The most common scenario is database primary keys: sequential IDs dramatically improve INSERT performance on B-tree indexes (used by PostgreSQL, MySQL, and most relational databases) because new rows are always appended at the end rather than inserted at random positions. V7 is also useful for event sourcing, logging, and any system where you want to sort records by creation time without an additional timestamp column. Stick with v4 when ordering is irrelevant, when you want zero information leakage about creation time, or when working with systems that expect fully random identifiers.

Related Tools