What a UUID is
A UUID (universally unique identifier; Microsoft calls the same thing a GUID) is a 128-bit value, conventionally written as 32 hexadecimal digits in a 8-4-4-4-12 pattern, for example 550e8400-e29b-41d4-a716-446655440000. The first digit of the third group is the version (the 4 above) and the first digit of the fourth group is the variant - 8, 9, a or b for the RFC 4122 / RFC 9562 layout. Because UUIDs can be minted anywhere with no central registry and still be practically unique, they are used for database keys, order and session IDs, file names and API resource identifiers.
Version 4 vs version 7
v4 is random: apart from the 4 version bits and 2 variant bits, all 122 bits come from a random number generator. This tool uses crypto.randomUUID() where available and otherwise 16 bytes from crypto.getRandomValues with the version and variant bits set by hand, exactly as the RFC specifies. The chance of a collision is astronomically small: generating a billion v4 UUIDs per second, you would need about 86 years to reach a 50% probability of a single duplicate.
v7, standardized in RFC 9562 (May 2024), puts a 48-bit Unix timestamp in milliseconds in the first 6 bytes, then the version nibble, 12 random bits, the variant bits and 62 more random bits. v7 IDs generated later always sort after earlier ones, which matters for databases: random v4 keys insert into random places in a B-tree index, causing page splits and poor cache behavior on large tables, while v7 keys append at the end like an auto-increment column. Choose v7 for new primary keys and v4 when you do not want the creation time to be inferable from the ID. Older versions still exist - v1 embeds a MAC address and timestamp, v3 and v5 hash a namespace and name with MD5 or SHA-1 - but v4 and v7 cover almost every modern use.
Formatting and storage tips
UUIDs are case-insensitive; the RFC recommends lowercase output, but .NET and the Windows registry conventionally use uppercase inside braces, which the format options reproduce. Dropping the hyphens gives a 32-character string that fits a CHAR(32) column or a file name. In PostgreSQL use the native uuid type (16 bytes); in MySQL, BINARY(16) is much more compact and faster to index than CHAR(36). Do not treat a UUID as a secret credential on its own: v4 values are unpredictable, but they are often logged and displayed, so pair them with real authentication.