Which UUID version should I use?+−
For most general-purpose IDs, use v4 - it's random and carries no information. If the UUID will be a database primary key or index, v7 is usually better because it sorts chronologically, which keeps indexes fast. Use v5 when you need the same input (like a URL or a name) to always produce the same UUID; use v1 only if you specifically need a timestamp embedded in the ID, and be aware it can reveal creation time.
What's the difference between v3 and v5?+−
Both are deterministic: given the same namespace and name, they always produce the same UUID. The only difference is the hash function - v3 uses MD5, v5 uses SHA-1. Since MD5 is cryptographically broken, v5 is the recommended choice for anything new; v3 exists mainly for compatibility with older systems.
Why does v7 sort chronologically?+−
A v7 UUID starts with a 48-bit Unix millisecond timestamp before the random bits, so when UUIDs are compared as plain strings (or bytes), earlier-created ones sort before later ones. Random v4 UUIDs have no such structure, which can fragment database indexes as new random values get inserted throughout the key range instead of at the end.
Are the UUIDs generated here cryptographically random?+−
Yes. v4 and the random portions of v1 and v7 use the Web Crypto API's crypto.getRandomValues, a cryptographically secure random number generator built into your browser - not Math.random(). Nothing is generated on a server or sent anywhere.
How likely is it that two random v4 UUIDs collide?+−
Astronomically unlikely. A v4 UUID has 122 random bits (6 bits are fixed to mark the version and variant), giving about 5.3 x 10^36 possible values. Generating a billion UUIDs per second for 100 years would still leave the odds of any collision at less than one in a billion - which is why v4 is trusted as a unique identifier without needing a central registry.
Is a UUID the same thing as a GUID?+−
In practice, yes - GUID (Globally Unique Identifier) is Microsoft's name for the same 128-bit identifier format defined by the UUID standard (RFC 4122). Some environments write it with uppercase letters or wrapped in curly braces ({...}), but the underlying value and structure are identical, so a UUID generated here is a valid GUID too.