← Back to blog

UUID vs GUID: Same Thing, Different Habits

November 17, 2026
UUID vs GUID: Same Thing, Different Habits

A UUID and a GUID are the same kind of identifier: a 128-bit value that you can generate anywhere without asking a central server for permission. "GUID" is the name Microsoft's ecosystem uses, "UUID" is the name the standards bodies and most other platforms use. The differences that actually bite are not in the name but in byte order, text casing, database sorting and which version you generate. If you want to see the formats side by side, our UUID, GUID and ULID generator produces them in one place.

Pingfloat
Keep essential web checks close
Explore Pingfloat’s web tools for website uptime monitoring, SSL certificate checks, file sharing, and network diagnostics in one user-friendly suite.
Visit

TL;DR

  • UUID and GUID refer to the same 128-bit identifier. RFC 9562 defines UUIDs, "also known as GUIDs", and Microsoft's own documentation uses the two terms interchangeably.
  • The practical gotcha is byte order: Microsoft COM GUIDs are saved little-endian, so the same ID can look scrambled when it moves between systems.
  • For new work, use v4 when you need pure randomness and v7 when the ID is a database key and you want it to sort by creation time. Use v5 for deterministic, name-based IDs.
  • ULID is a sortable alternative with a shorter text form, but it is not a formal standard and most database UUID types will not accept it.
  • UUID collisions are an accidental-duplicate problem, not an attack problem. A UUID is not a secret and should never act as a password or access token.

Table of Contents

What UUID and GUID actually mean

UUID stands for Universally Unique Identifier. GUID stands for Globally Unique Identifier. Both describe a 16-byte (128-bit) number designed so that two machines can create IDs at the same time without coordinating and still almost never collide.

The IETF's RFC 9562, published in May 2024, is the current specification. It replaces the older RFC 4122, defines UUIDs as 128-bit identifiers that need no central registration, and notes they are also known as GUIDs. Microsoft's protocol documentation agrees: its glossary says the two terms are used interchangeably and that "GUID" on its own does not imply any particular generation algorithm. Its data types specification describes a GUID as a 16-byte structure meant as a unique identifier for an object.

So if a teammate on a .NET stack says "GUID" and a teammate on a Python or Postgres stack says "UUID", they are talking about the same thing. Treat the word as a dialect, not a data type.

Where the two worlds really differ

The name is the same. Four habits are not.

Text format

The standard text form is 32 hexadecimal digits in five dash-separated groups of 8-4-4-4-12, for example a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11. PostgreSQL's documentation shows exactly this layout. Windows tooling often wraps the value in curly braces and writes it in uppercase. Both are the same ID. When you compare IDs as strings, normalize first: strip the braces, lowercase everything, then compare.

Byte order

This is the one that causes real bugs. RFC 9562 points out that Microsoft COM GUIDs are stored in little-endian order. In practice, the first three groups of a GUID can have their bytes reversed when you read the raw 16 bytes in one system and write them in another. The text looks the same on both sides only if each side converts consistently. If you ever see an ID whose first groups look "flipped" after passing through a binary column, a file format or another language, check the byte order before you suspect data corruption.

Sorting

SQL Server's uniqueidentifier does not sort in the order the text suggests, and random v4 values scatter inserts across an index no matter the platform. That is why time-ordered versions have become popular, covered below.

Defaults

.NET developers tend to reach for a random GUID by default, and most other stacks do the same with random v4 UUIDs. The default is fine for many jobs. It stops being fine when the ID becomes a clustered primary key on a large table.

The UUID versions, in plain words

RFC 9562 defines versions 1 through 8. You rarely need all of them. Here is the short version, based on the RFC's own guidance.

VersionHow it is madeTypical use
v1 / v6Gregorian-calendar timestamp (v6 reorders the bits so they sort)Legacy systems
v3MD5 hash of a namespace and a nameLegacy deterministic IDs
v4Random, with 122 random bitsGeneral purpose, security-related uses
v5SHA-1 hash of a namespace and a nameDeterministic IDs
v748-bit Unix millisecond timestamp plus 74 random bitsDatabase keys, time-ordered IDs
v8Custom, vendor-defined layoutSpecial cases

The RFC's recommendations are direct: use v7 instead of v1 or v6 if possible, use v5 in place of v3, and use v4 for any security-related use. If you want a walkthrough with migration tips, our post on UUID version choices covers v4, v5 and v7 for developers.

UUID v7 vs v4: which one for a database key?

A v4 UUID is random from end to end. That is its strength: nothing about it reveals when or where it was made. It is also why it is awkward as a primary key. New rows land in random positions in the index instead of at the end.

A v7 UUID puts a Unix-epoch millisecond timestamp in the most significant 48 bits and fills the rest with 74 random bits, per RFC 9562. The RFC also describes an optional sub-millisecond fraction and counter so that IDs made in the same millisecond still increase. The result: values created later sort after values created earlier, so inserts cluster at the end of the index, much as they do with an auto-increment integer, while keeping the ability to generate IDs on any node.

Support is arriving in the tools you already use. PostgreSQL 18 natively generates both v4 and v7, according to its UUID type documentation. The same page notes that in distributed systems UUIDs give a better uniqueness guarantee than sequence generators, which are only unique within one database.

A simple rule of thumb:

  1. Public or security-adjacent ID, nothing to infer from it: v4.
  2. Database primary key, event or log ID, anything you will sort or page by creation time: v7.
  3. The same input must always yield the same ID: v5 (see below).

One trade-off to know before choosing v7: it embeds a millisecond timestamp, so anyone holding the ID can read roughly when it was created. If creation time is sensitive, use v4 for the externally visible ID and keep v7 internal.

Deterministic UUIDs: v5, and why not v3

Sometimes you want the same input to produce the same UUID every time, for instance to turn a URL or an email-based key into a stable identifier during a data import. Name-based UUIDs do this. You combine a namespace UUID with a name, hash them, and format the result as a UUID.

RFC 9562 says v3, which uses MD5, should be replaced by v5, which uses SHA-1. It also says that name-based UUIDs derived from SHA-256 must not be labeled v5; they belong in the custom v8 space. So if a library offers you a "SHA-256 UUID", it is a v8 UUID, and other systems will not recognize it as a standard name-based one.

Two cautions apply to deterministic IDs:

  • They are guessable when the input is small. A security.stackexchange responder points out that hash-derived UUIDs can be reversed when the input space is small, such as sequential integers, and suggests a keyed HMAC instead when that matters.
  • The hash only decides uniqueness, not secrecy. Do not treat a v5 UUID as an obscured version of the original value.

MD5 vs SHA-256, and what the UUID rules say about them

These two hashes show up in this conversation because name-based UUIDs are built on hash functions, and because developers often use hashes as IDs and checksums.

MD5 produces a 128-bit digest, written as 32 hex characters. SHA-256 produces a 256-bit digest, written as 64 hex characters. MD5 is no longer considered collision-resistant, which means someone can deliberately craft two different inputs with the same hash. SHA-256 has no known practical collision attack. The ITU-T's UUID page draws the same line for UUIDs: it warns that collision probability rises when UUIDs derive from MD5 hashes or from weak random numbers rather than from SHA-1 and cryptographic-quality randomness.

What that means in daily work:

  • New checksums, signatures and integrity checks: SHA-256.
  • Legacy compatibility or catching accidental file corruption: MD5 still turns up, but it should not be the choice for anything an attacker could tamper with.
  • Passwords: neither. Use a purpose-built password hashing function such as Argon2id. Our guide to hashing algorithms to trust goes into the details.
  • SHA-1 deprecation: SHA-1 is also deprecated for security uses, though RFC 9562 still builds v5 on it because a UUID needs uniqueness, not collision resistance against an attacker. For new designs that need a hash-derived ID, you are now choosing between v5 for interoperability and a v8 layout for a stronger hash.

To compare outputs while you decide, the hash generator shows MD5, SHA-1, SHA-256 and SHA-512 digests of the same input, which makes the 32-versus-64 character difference obvious.

UUID vs ULID

ULID is the most common alternative to UUID in this discussion. According to the ULID specification, a ULID is also 128 bits: a 48-bit Unix-millisecond timestamp followed by 80 random bits, written as 26 characters in Crockford Base32. It is lexicographically sortable, and the spec describes a monotonic mode for IDs generated in the same millisecond.

UUID v4UUID v7ULID
Size128 bits128 bits128 bits
Text length36 characters36 characters26 characters
Sorts by timeNoYesYes
Random bits1227480
Formal standardYes (RFC 9562)Yes (RFC 9562)No, a community spec
Native database typeCommonGrowing, e.g. PostgreSQL 18Rarely

The case for ULID is shorter, cleaner text and easy sorting. The case for v7 is that it gives you nearly the same time-ordered behavior inside the standard that databases, drivers and ORMs already understand. A comparison of v4, v7 and ULID notes that ULID is a de facto rather than formal standard, that most relational databases reject it in their UUID column types, so it is usually stored as 26-character text, and that like v7 it exposes a millisecond timestamp.

If your stack already speaks UUID, v7 is the lower-friction route to sortable IDs. Choose ULID when the short, URL-friendly text form matters more than native database support.

UUID vs ULID

How likely is a UUID collision?

For accidental duplicates, the risk is negligible with a good random source. A v4 UUID has 122 random bits, and the ITU-T states that a UUID generated according to the standard is guaranteed different from others or extremely likely to be different, supporting allocation rates of 10 million per second per machine, in its UUID overview. The same page makes the caveat that matters: quality of randomness is what the guarantee rests on.

The variables that move your real-world risk are:

  • A weak random number generator. A seeded or low-entropy generator can repeat. Use your platform's cryptographic random source.
  • Copying or cloning state. Virtual machine snapshots and forked processes can reuse generator state if the library keeps it in memory.
  • Shorter or truncated IDs. Cutting a UUID down to a few characters throws away the margin the 128 bits provide.
  • Hash-based IDs from small input spaces. Fewer distinct inputs, or MD5 with adversarial input, change the picture entirely.

RFC 9562's collision section also asks you to weigh consequences. A duplicate that skews a log statistic is harmless; a duplicate key that sends something to the wrong place is not. Match the version and the randomness source to what a collision would cost you.

UUIDs are not secrets

GUIDs protect against accidental collisions, not deliberate ones. Eric Lippert, a former Microsoft compiler engineer, compares them to ISBNs and traffic lights, which only work when people are not hostile. RFC 9562's security section says implementations must not assume UUIDs are hard to guess and must not use them as security capabilities, meaning identifiers whose mere possession grants access. A password reset link or a download URL needs a separate token from a cryptographic generator, with its own expiry.

Practical checklist before you pick

  1. Decide whether the ID sorts. If it is a primary key on a growing table, start with v7.
  2. Decide whether the ID is public. If its timestamp would leak something you care about, use v4 for the outward-facing value.
  3. Decide whether it must be reproducible. Then use v5, and plan for the guessability of small inputs.
  4. Store it in the native type. A 16-byte binary or native UUID column is smaller and faster than a 36-character string.
  5. Normalize on the way in. Lowercase, no braces, and test your byte-order handling across any language boundary that touches raw bytes.
  6. Never use it as an access credential.

Where our tools fit

We built the UUID, GUID and ULID generator for exactly these moments: you need a quick sample ID for a fixture, a migration script or a bug report, and you want to see the format you are discussing. Pair it with the hash generator when you are working on name-based IDs or checksums. The rest of the free suite on Pingfloat covers the checks that tend to come up around the same work: JSON formatting, Base64 encoding, JWT decoding, timestamp conversion, uptime monitoring and SSL certificate checks. Core tools need no installation or account.

Pingfloat

If you are encoding hash output or IDs for transport, our comparison of Base64 vs hex explains the size and readability trade-offs.

Our view

Most arguments about UUID versus GUID are really arguments about defaults. The identifier is the same; what differs is the habit each platform builds around it. We think the useful question is never "which word is right" but "what will this ID be used for in two years".

Developers reach for our tools in the middle of a task, with a half-finished migration or a failing request open in another tab. That shapes how we think about this topic: generate a sample, look at its shape, compare it to what your database expects, and move on. Free, instant tools suit that rhythm, which is why the core of Pingfloat needs no installation or account.

Our advice is short. Pick v7 when order matters, v4 when nothing should be inferable, v5 when the same input must give the same ID, and never treat any of them as a secret. Write the choice down in your schema notes so the next engineer does not have to rediscover it.

Andreas

FAQ

Is a GUID the same as a UUID?

Yes, for practical purposes. Microsoft's documentation uses the terms interchangeably, and RFC 9562 describes UUIDs as also known as GUIDs. The differences you may notice are cosmetic, such as braces and uppercase letters, plus the little-endian byte storage used by Microsoft COM GUIDs.

Which UUID version should I use today?

Use v4 when you want a random identifier with nothing to infer from it, and v7 when you want IDs that sort by creation time, such as database primary keys. RFC 9562 recommends v7 over v1 and v6 where possible, v5 over v3, and v4 for security-related uses. Use v5 when the same input must always produce the same UUID.

Can two UUIDs ever collide?

In theory yes, in practice almost never by accident when the random source is sound. A v4 UUID carries 122 random bits. Collisions in the real world come from weak random generators, copied generator state or truncated IDs, so use a cryptographic random source and keep the full 128 bits.

Should I use ULID instead of UUID?

If your database and libraries already support UUIDs, v7 gives you time-ordered IDs inside a formal standard. ULID offers a shorter 26-character text form and is sortable, but it is a community specification and is usually stored as text, since most database UUID types do not accept it.

Are MD5 and SHA-256 interchangeable for generating IDs?

No. MD5 gives a 128-bit digest and is not collision-resistant against deliberate attacks, while SHA-256 gives a 256-bit digest with no known practical collision attack. For a standard name-based UUID use v5; a SHA-256-derived name-based UUID belongs in the v8 space, according to RFC 9562.

Sources