UUID and GUID Generation, Every Version
Generate any UUID version (1-7) plus Microsoft-style GUIDs, with validation and decoding. In practice the choice collapses to two: v4 when you need a random unique ID, v7 when the IDs land in a database index and should sort by creation time. The full version-by-version breakdown lives in UUID versions explained - and if you are wondering whether a GUID is something different (mostly it is not), see UUID vs GUID.
UUID Version Overview
Time-based UUID using MAC address. Chronological ordering, embedded timestamp.
Exposes MACUUID with embedded POSIX UID/GID. For legacy DCE systems, rarely used.
LegacyDeterministic UUID from namespace and name. Same input = same output.
DeterministicRandom UUID with 122 bits of entropy. Most popular choice for general use.
RecommendedLike v3, but uses SHA-1. Preferred for new name-based UUID projects.
DeterministicReordered v1 for lexicographic sorting. Better for database indexes.
SortableUnix timestamp + random. Sortable, privacy-friendly, modern standard.
Recommended for time-orderedMicrosoft format. Uppercase, optional braces. For .NET, SQL Server, Azure.
MicrosoftWhich Version to Choose?
| Use Case | Recommendation |
|---|---|
| General-purpose unique IDs | UUID v4 - random, simple |
| Time-sortable IDs | UUID v7 - better DB indexing |
| Deterministic IDs from names | UUID v5 - hash namespace + name |
| Extract timestamp | v1, v6, v7 |
| Microsoft ecosystem | GUID - .NET, SQL Server |