UUID vs GUID Explained: Versions 1, 4, and 7 (and Which One to Use)

UUID vs GUID: the same 128-bit identifier under two names. A breakdown of the RFC 9562 bit layout, versions 1/4/7, and why v7 is rising for database keys.

By FakeName Editorial TeamPublished June 25, 2026Last updated June 25, 20269 min read

A UUID and a GUID are the same thing: a 128-bit identifier, written as 32 hexadecimal digits, that two computers can generate independently without ever colliding. UUID (Universally Unique Identifier) is the IETF's name; GUID (Globally Unique Identifier) is Microsoft's name for the identical value. There is no difference in the bits. This article walks the RFC 9562 bit layout [rfc9562] and compares the three versions you actually meet in code: 1, 4, and 7.

Microsoft coined GUID for COM and carried it into .NET; the IETF standardized the same structure as UUID. Where the two names diverge is never in the value, only in *text formatting* and occasionally *byte order* inside specific Microsoft tooling, which the final section covers.

What is a GUID, and how does it relate to a UUID?

A GUID is Microsoft's term for a 128-bit identifier used to label objects, COM interfaces, classes, and database rows without a central authority issuing numbers. It is bit-for-bit the same structure the IETF calls a UUID. The format traces back to the 1980s Apollo Network Computing System, which Microsoft adopted [wikipedia-uuid]. Both names describe a value like `f47ac10b-58cc-4372-a567-0e02b2c3d479`.

A UUID is 128 bits, normally written as 32 hex digits in five hyphen-separated groups (8-4-4-4-12). Two fields are reserved and not free for data: the version (4 bits) names the generation algorithm, and the variant (2 to 3 bits) names the layout rules. Almost all code uses the IETF variant, where the variant bits read `10x`.

FieldBitsHex positionPurpose
time_low / random321-8Low time field (v1/v6) or random data (v4)
time_mid / random169-12Mid time field or random data
version413Version number 1-8; this nibble is fixed
time_high / random1214-16Remaining time field or random data
variant2-317Variant marker; top bits are 10x for IETF
clock_seq / random13-1417-20Clock sequence (v1) or random data
node / random4821-32MAC-derived node (v1) or random data
The 128-bit UUID layout for the IETF variant (RFC 9562 field positions).

What is RFC 9562, the current UUID specification?

RFC 9562 is the IETF UUID specification published in May 2024. It obsoletes RFC 4122 from 2005 [rfc9562][rfc4122] and does three things: it tightens the language around existing versions 1 through 5, it formally adds versions 6, 7, and 8, and it gives implementers explicit rules on randomness, monotonicity, and time-bit ordering so identifiers can sort by creation time.

Versions 6, 7, and 8 exist to fix two problems with the original version 1. Version 1 was reliable for uniqueness but sorted in a confusing byte order and embedded the generating machine's network MAC address, which leaked hardware identity. The newer versions keep time-ordering and drop the leak.

This specification defines UUIDs (Universally Unique IDentifiers) -- also known as GUIDs (Globally Unique IDentifiers) -- and a Uniform Resource Name namespace for UUIDs. A UUID is 128 bits long and is intended to guarantee uniqueness across space and time.
RFC 9562, Universally Unique IDentifiers (UUIDs), IETF, May 2024

How do UUID versions 1, 4, and 7 compare?

Versions 1, 4, and 7 cover almost everything you meet in practice. Version 1 is the classic timestamp-plus-MAC design. Version 4 is 122 random bits and the default in most languages. Version 7 puts a 48-bit Unix millisecond timestamp in front of 74 random bits, making it sortable by creation time. The table below shows where they differ on the properties that decide a design.

PropertyVersion 1Version 4Version 7
Source of bitsTimestamp + clock seq + node122 random bits48-bit Unix ms time + 74 random bits
Random bits~14 (clock seq)12274
Sortable by creation timeNo (mixed byte order)NoYes
Reveals generation timeYesNoYes (millisecond)
Reveals machine identityYes (MAC address)NoNo
Collision riskVery lowNegligibleNegligible
Needs a clockYesNoYes
Best useLegacy systemsGeneral-purpose IDs, tokensDatabase primary keys
UUID versions 1, 4, and 7 across the properties developers care about.

Three things on that table earn a closer look. Version 1 exposes both the generating machine's MAC address and a timestamp, which is why RFC 9562 steers new work toward versions 4, 6, and 7 [rfc9562]. Version 4 spends 122 of its 128 bits on randomness, telling an observer nothing about when or where it was made. Version 7 trades some opacity for order: anyone holding a v7 value can read its creation time to the millisecond.

Why is version 4 the safe default?

Version 4 is the safe default because it needs no clock, no coordination between machines, and no MAC address, and it leaks nothing about its origin. With 122 random bits, you would need to generate roughly a billion UUIDs per second for about 85 years to reach a 50 percent chance of one collision [wikipedia-uuid]. That opacity matters when an identifier shows up in a URL, an email, or a log a third party can read.

One caveat: a v4 UUID is only as unique as the random number generator behind it. Draw those 122 bits from a cryptographically secure source rather than a basic pseudo-random function, or the uniqueness guarantee weakens [nist-rng].

Why is version 7 rising for database primary keys?

Version 7 is rising for database primary keys because it fixes index locality. A B-tree index keeps rows sorted, so a random v4 key lands each insert in an unpredictable spot, touching cold pages across disk and cache and splitting index pages repeatedly. A v7 key carries a 48-bit Unix millisecond timestamp in its first bits, so new rows sort near each other and append near the tail of the index, keeping recent pages hot.

The payoff is largest when the storage engine *clusters* table data by primary key. In MySQL InnoDB, the clustered index physically orders rows by primary key, so a random v4 key inserts rows in random physical positions, fragmenting the table [innodb-index]. A time-ordered v7 key avoids that. PostgreSQL keeps the primary key in a separate B-tree instead of clustering the heap, so the gain is smaller there but still real for index size and cache behavior.

DimensionVersion 4 (random)Version 7 (time-ordered)
Insert position in indexRandom, scatteredSequential, near tail
Index page splitsFrequentRare
Cache locality on insertPoor (cold pages)Good (hot pages)
InnoDB clustered index fitPoorGood
Range scan by creation timeNot possiblePossible
Reveals creation timeNoYes (consider before exposing)
Cross-system generationTrivialTrivial
Version 7 versus version 4 as a database primary key.

The cost of v7 is privacy. Because it encodes the creation timestamp, publishing a v7 value lets anyone read when a record was made and estimate creation rates by comparing two values. If a record's age is sensitive, keep v7 internal and hand the outside world a separate v4 or an opaque slug.

How do you read the parts of a v7 UUID?

Take the v7 value `018f9d4e-7b2a-7c3d-9e1f-a2b3c4d5e6f7`. Its first 48 bits in hex are `018f9d4e7b2a`, which is 1,716,331,117,354 milliseconds in decimal and decodes to a moment in late May 2024. The `7` in the third group is the version nibble, and the `9` starting the fourth group confirms the IETF variant. In a v4 value, those same positions are pure randomness and decode to nothing.

What GUID-specific quirks should I know about?

The two GUID quirks that trip people up are braces and byte order, and neither changes the underlying value. The Windows registry and some COM APIs wrap GUIDs in braces, like `{f47ac10b-58cc-4372-a567-0e02b2c3d479}`. Separately, when a GUID is stored as a binary blob, certain Microsoft components write the first three groups in little-endian byte order while the last two stay big-endian.

That little-endian mix bites when you treat a stored GUID as a flat 16-byte array: a round trip through such a system can reorder bytes and break an equality check. Before you compare a database GUID against a string, normalize both the text formatting and the byte order.

StyleExampleWhere seen
Canonical (IETF)f47ac10b-58cc-4372-a567-0e02b2c3d479RFC 9562, most APIs
Braced (Microsoft){f47ac10b-58cc-4372-a567-0e02b2c3d479}Windows registry, COM
No hyphensf47ac10b58cc4372a5670e02b2c3d479Compact storage, URLs
URN namespaceurn:uuid:f47ac10b-58cc-4372-a567-0e02b2c3d479RDF, semantic web
Uppercase hexF47AC10B-58CC-4372-A567-0E02B2C3D479Some Microsoft output
Common UUID/GUID text representations of the same value.

What does our generator produce, and how should you use it?

The dedicated UUID generator emits version-4 GUIDs: 122 random bits, no embedded timestamp, no machine identity, generated locally. That fits the only purposes we support, which are software testing, QA fixtures, form-filling, seeding development databases, and protecting your privacy when a site demands an identifier it has no real need for. Every value is fictional.

Need v7 keys for production? Generate them inside your application framework or database. Modern PostgreSQL, IBM Db2, and many drivers ship built-in UUID functions [ibm-uuid]. Use our v4 output for test data and disposable identifiers, and reach for /tools/password-generator when you actually need a secret instead of an identifier.

Which UUID version should I choose? A quick decision guide

  • Need a general-purpose unique ID and want to leak nothing? Use version 4. It is the default for good reasons.
  • Building a database primary key on a clustering engine like InnoDB? Use version 7 for index locality, but keep it internal if creation time is sensitive.
  • Maintaining a legacy system that already uses version 1? Leave it in place, but avoid v1 for new work because it exposes the MAC address.
  • Need a secret, token, or password? A UUID is the wrong tool; use /tools/password-generator.
  • Generating test data? Our generator at / produces fictional version-4 GUIDs for exactly this.

References & sources

  1. RFC 9562: Universally Unique IDentifiers (UUIDs)IETF
  2. RFC 4122: A Universally Unique IDentifier (UUID) URN NamespaceIETF
  3. Universally unique identifierWikipedia
  4. Clustered and Secondary Indexes (InnoDB)Oracle MySQL Documentation
  5. Recommendation for Random Number Generation Using Deterministic Random Bit Generators (SP 800-90A Rev. 1)NIST
  6. Generating universally unique identifiers (UUIDs)IBM Documentation

Frequently asked questions

Is a GUID the same as a UUID?+

Yes. GUID (Globally Unique Identifier) is Microsoft's name for the same 128-bit value the IETF calls a UUID. The bit layout, version field, and variant field are identical. A GUID generated by .NET and a UUID generated by a Linux tool follow the same RFC 9562 rules.

What is the difference between UUID v4 and v7?+

Version 4 is almost entirely random with no embedded time, so values are unsortable and scatter randomly across a database index. Version 7 puts a 48-bit Unix millisecond timestamp at the front, so values sort by creation time and insert near each other in a B-tree index, reducing page splits.

Should I use UUID v7 for a database primary key?+

Often yes, if your storage engine clusters rows by primary key (such as MySQL InnoDB) or otherwise benefits from sequential inserts. Version 7's time-ordering gives better index locality than v4. Use v4 when you specifically want unpredictable, non-time-revealing identifiers.

Which UUID version should I use by default?+

Version 4. It is widely supported, requires no clock or coordination, leaks no information about when or where it was generated, and is the version most libraries produce by default. Reach for v7 mainly when you have measured a database index hotspot.

What is RFC 9562?+

RFC 9562 is the May 2024 IETF specification for UUIDs. It obsoletes the older RFC 4122 from 2005, restates versions 1 through 5, and formally introduces versions 6, 7, and 8 for time-ordered and custom UUIDs.

Can two UUIDs ever collide?+

It is possible but astronomically unlikely for version 4. With 122 random bits, you would need to generate roughly a billion UUIDs per second for about 85 years before a single collision became likely. For practical systems the collision risk is treated as negligible.

We use cookies for analytics and ads to keep this generator free. See our Privacy Policy.