UUID Generator
Generate random UUIDs (Universally Unique Identifiers) in v4 and v7 formats. Choose quantity, format, and copy the results instantly.
How Does the UUID Generator Work?
The UUID Generator is a free online tool that creates Universally Unique Identifiers using cryptographically secure random number generation. UUIDs are 128-bit identifiers that are designed to be unique across all devices and systems without requiring a central authority to coordinate their creation. They are represented as 32 hexadecimal digits displayed in five groups separated by hyphens, following the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
This tool supports two UUID versions. UUID v4 is the most widely used format and generates completely random identifiers using the crypto.getRandomValues() API, which provides cryptographically strong random values. The only fixed bits in a v4 UUID are the version indicator (the 13th character is always "4") and the variant indicator (the 17th character is always "8", "9", "a", or "b"). The remaining 122 bits are random, resulting in approximately 5.3 undecillion (5.3 times 10 to the 36th power) possible unique values.
UUID v7 is a newer format (defined in RFC 9562) that embeds a Unix timestamp in the first 48 bits of the identifier, followed by random data in the remaining bits. This makes v7 UUIDs time-sortable, which is a significant advantage for database performance. When used as primary keys in databases, v7 UUIDs maintain insertion order and produce better index locality compared to fully random v4 UUIDs, resulting in faster queries and reduced index fragmentation.
UUID v4 vs UUID v7
UUID v4 is purely random and has been the standard choice for unique identifier generation since its introduction in 2005. Its randomness means that UUIDs generated on different machines at the same time will almost certainly be different. However, the fully random nature means that v4 UUIDs have poor database indexing characteristics because consecutive insertions scatter across the B-tree index rather than being appended sequentially.
UUID v7 addresses this performance issue by placing a millisecond-precision Unix timestamp in the most significant bits. This means UUIDs generated later in time will naturally sort after earlier ones, maintaining chronological order. The timestamp prefix also makes it possible to extract the approximate creation time from a v7 UUID, which can be useful for debugging and auditing. The remaining bits are still random, preserving the uniqueness guarantee even when multiple UUIDs are generated within the same millisecond.
Where UUIDs Are Used
UUIDs are used throughout software engineering wherever unique identifiers are needed. Databases use them as primary keys to avoid auto-increment conflicts in distributed systems. APIs use them as resource identifiers in RESTful endpoint paths. Session management systems use UUIDs as session tokens. Distributed systems use them for message IDs, transaction IDs, and correlation IDs. File systems use UUIDs for partition identifiers. Every major programming language and database system provides built-in UUID support, making them a universal solution for unique identification across platforms and services.
The choice between v4 and v7 depends on the specific use case. For general-purpose unique identifiers where ordering does not matter, v4 remains the simplest and most widely supported option. For database primary keys, event IDs, or any scenario where chronological sorting would be beneficial, v7 offers significant performance and usability advantages. Many organizations are transitioning from v4 to v7 as the newer standard gains broader support across database drivers and ORM frameworks.