What Is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier used in software development, database management, APIs, distributed systems, and microservices to uniquely identify records, objects, and resources.
A UUID is normally represented as 32 hexadecimal characters separated into five groups, such as 550e8400-e29b-41d4-a716-446655440000. The hexadecimal representation contains 128 bits.
Unlike an auto-incrementing integer, a UUID can be generated independently by an application without contacting a central database for the next available ID.
UUID vs GUID
UUID (Universally Unique Identifier) and GUID (Globally Unique Identifier) generally refer to the same 128-bit identifier.
GUID is the terminology historically associated with Microsoft technologies, while UUID is the terminology used by modern standards. In .NET, the System.Guid type represents a UUID-compatible identifier.
For practical purposes, UUID and GUID are interchangeable terms.
How Unique Is a UUID?
UUIDs are not mathematically guaranteed to be unique. They are designed to make accidental collisions extremely unlikely.
A UUID v4 reserves 6 bits for the version and variant, leaving 122 random bits. This provides approximately 5.3 × 10^36 possible random values.
The probability of a collision increases as more UUIDs are generated, but the available space makes accidental UUID v4 collisions extraordinarily unlikely for normal applications.
The quality of the random number generator matters. UUIDs should be generated using an appropriate random or cryptographically secure random source.
UUID Versions
UUID versions define different ways of generating and structuring UUIDs. A newer version is not automatically better; each version has a different purpose.
| Version | Description |
|---|---|
| UUID v1 | Timestamp and node-based |
| UUID v3 | Name-based, MD5 |
| UUID v4 | Random |
| UUID v5 | Name-based, SHA-1 |
| UUID v6 | Reordered timestamp-based |
| UUID v7 | Timestamp and random data |
| UUID v8 | Application-defined |
For most new applications, UUID v4 and UUID v7 are the versions developers are most likely to consider.
UUID v3 and v5 are useful when deterministic UUIDs are required. UUID v6 provides a reordered timestamp-based format, while UUID v8 provides space for application-defined UUID layouts.
UUID v4: The Most Common UUID
UUID v4 is the most common choice for generating random UUIDs.
UUID v4 contains 122 random bits, with the remaining bits identifying the UUID version and variant.
UUID v4 is a good general-purpose choice when an application needs a unique identifier without a timestamp or ordering requirement. It is commonly used for database records, API resources, users, orders, transactions, files, test data, and distributed applications.
If you simply need a random UUID, UUID v4 is usually the best starting point.
UUID v7: A Modern UUID Standard
UUID v7 is a modern UUID format defined by RFC 9562. It combines a Unix timestamp with random data.
Unlike UUID v4, UUID v7 values are generally sortable by creation time. This makes UUID v7 useful when an application wants independently generated UUIDs while also benefiting from chronological ordering.
UUID v7 is particularly useful for database primary keys, indexed values, event IDs, logs, and other applications where chronological ordering is useful.
Because the timestamp is part of a UUID v7, it can reveal the approximate time an identifier was generated.
UUID v4 vs UUID v7
| UUID v4 | UUID v7 | |
|---|---|---|
| Primary characteristic | Random | Time-ordered |
| Random data | 122 bits | Random data + timestamp |
| Timestamp | No | Yes |
| Creation-time ordering | No | Generally yes |
| Best use | General-purpose IDs | Time-ordered IDs |
Choose UUID v4 when you primarily need a random identifier.
Choose UUID v7 when chronological ordering is useful, particularly for database keys, indexed values, event IDs, and other applications where creation-time ordering matters.
UUID v4 remains the most common choice. UUID v7 is a modern option when time ordering is important.
Common UUID Uses
UUIDs are commonly used as database keys and application identifiers for users, customers, orders, transactions, files, and documents. They are also useful for event IDs, request IDs, job IDs, and correlation IDs, particularly in applications where identifiers are generated across multiple services or systems.
UUIDs in Databases
UUIDs are widely used as database primary keys and foreign keys because an application can generate an identifier before inserting a record. This is particularly useful when multiple servers, services, or applications create records independently.
UUIDs are supported by major database systems including PostgreSQL, MySQL, MariaDB, Microsoft SQL Server, Oracle Database, and SQLite. PostgreSQL provides a native uuid data type, while Microsoft SQL Server provides uniqueidentifier.
UUIDs require more storage than typical integer keys and can produce larger indexes. Random UUID v4 values also have no natural ordering, which can affect index insertion behavior on large tables. UUID v7 provides chronological ordering that can be useful for indexed data.
Whether a UUID or integer is the better database key depends on the database engine, schema, indexes, workload, and application architecture.
Who This Site Is For
GUIDGenerator.com is built primarily for software developers and IT professionals who need to generate, validate, or understand UUIDs and GUIDs.
Our tools are useful for application developers, backend developers, database administrators, DevOps engineers, QA engineers, data engineers, and software architects working with APIs, databases, distributed systems, and application code.
Whether you need a UUID for a SQL query, database record, API request, test data, application code, or debugging, our tools provide a quick way to work with UUIDs and GUIDs.
Our UUID and GUID Tools
GUIDGenerator.com provides a collection of UUID and GUID tools for software developers, database professionals, QA engineers, and other IT professionals.
Our UUID generator creates random UUID v4 values and time-ordered UUID v7 values for application code, database records, SQL queries, APIs, configuration, and test data.
Our UUID validator checks UUID format and identifies the UUID version and variant. Our UUID decoder examines the structure of a UUID and can identify information such as timestamps contained in timestamp-based UUID versions.
Together, our tools provide a quick way to generate, validate, decode, and understand UUIDs and GUIDs without having to write your own code or use a separate development tool.
UUID and GUID Resources for Developers
GUIDs and UUIDs are fundamental building blocks in modern software development and database management. They provide a practical way to create identifiers that can be generated independently across applications, databases, servers, and services.
GUIDGenerator.com provides UUID and GUID tools and developer resources to help you work with these identifiers. Our tools let you generate, validate, and decode UUIDs, while our content covers practical topics for developers and database professionals.
The site includes dozens of articles and guides, including our UUID Versions Guide, UUIDs in Databases resources, and Engineering Blog, covering UUID standards, database design, software development, and related engineering topics.
Whether you need to generate a GUID for a database record, test an application, write a SQL query, or understand how UUIDs work, our tools and resources are here to help.
More Information About UUID Versions
For a more detailed comparison of UUID versions, visit our Complete Guide to UUID Versions.
More Information About Standards
Globally Unique Identifier - Wikipedia, the free encyclopedia
GUID Structure - Microsoft.com
RFC 9562 (2024)
RFC 4122 (2005)
Tools, UUID Versions Guide, dozens of articles in UUIDs In Databases & Engineering Blog.