Order numbers, user IDs, and uploaded file names are full of hyphenated strings of hexadecimal characters. Those are UUIDs. Here is the short version: a UUID is a 128-bit globally unique identifier, written as 36 characters in an 8-4-4-4-12 pattern. For a new project's database primary key, use v7; for a general random ID, use v4; to derive a stable ID from a name, use v3 or v5.
UUID stands for Universally Unique Identifier, a 128-bit identifier defined by RFC 9562 (published in May 2024, replacing RFC 4122 from 2005). It is written as 32 hexadecimal characters in five groups, separated by hyphens, in an 8-4-4-4-12 pattern, 36 characters including the hyphens — for example, 550e8400-e29b-41d4-a716-446655440000. The design goal is that anyone, anywhere can generate an ID without a central issuing authority and without coordination, and it will almost never collide with anyone else's.
The five groups are not just for looks: two digits mark the version and the variant, and reading those two is enough to identify which version a UUID is.
| Group | Length | Content |
|---|---|---|
| 1st | 8 chars | Timestamp or random data (depends on the version) |
| 2nd | 4 chars | Timestamp or random data (depends on the version) |
| 3rd | 4 chars | First digit is the version: 1 is v1, 4 is v4, 7 is v7 |
| 4th | 4 chars | First digit is the variant: one of 8, 9, a, b |
| 5th | 12 chars | Node identifier or random data (depends on the version) |
The version hides in the first digit of the third group, and the variant in the first digit of the fourth: in 550e8400-e29b-41d4-a716-446655440000, the third group starts with 4, so it is v4, and the fourth starts with a, which fits the variant rule. The mainstream variant is binary 10, the hex digits 8, 9, a, and b. Those two digits are enough.
All three share the same outward shape; what differs is what the 128 bits hold: v1 holds time and machine information, v4 holds nothing but random data, and v7 holds time at the front and random data at the back.
| Version | What is inside | Time-ordered? | Random bits | Use it for |
|---|---|---|---|---|
| v1 | 60-bit timestamp + node ID | Yes | Very few | Legacy compatibility |
| v4 | 122 random bits | No | 122 bits | General random IDs, request IDs, temporary identifiers |
| v7 | 48-bit millisecond timestamp + 74 random bits | Yes | 74 bits | New database primary keys |
| v3/v5 | Hash of name + namespace (MD5/SHA-1) | No | Set by the hash | Same name always yields the same ID |
The v1 timestamp is 60 bits counted in 100-nanosecond intervals since October 15, 1582, and the node identifier was historically the machine's MAC address: sortable, but it leaks when and where the ID was made, so today v1 mostly survives in legacy systems. The v4 value is 122 bits of pure randomness: the simplest and most common choice. Version 7 arrived with RFC 9562 in 2024: the first 48 bits are a Unix timestamp in milliseconds, the remaining 74 bits are random (or a counter), so it keeps the randomness while making newer IDs sort after older ones. Versions 3 and 5 hash a namespace plus a name, so the same name always produces the same UUID.
Use v7. A primary key needs more than uniqueness; it needs to be kind to its index. Primary keys usually carry a B-tree index, and new rows insert in key order. Version 4 values are pure random, so each new ID lands at an arbitrary spot in the index, splitting index pages as writes accumulate. Version 7 starts with a millisecond timestamp, so each new ID sorts after the previous one and inserts are mostly sequential appends. PostgreSQL 18 (September 2025) ships a built-in uuidv7() function, and Python 3.14 ships uuid7(). Version 4 still fits everything that does not need ordering. One caveat: the v7 timestamp is plain text — anyone holding the ID can read its creation time to the millisecond. If you would rather not reveal when the record was created, stay with v4.
When the same name must always produce the same ID. Version 3 hashes the namespace plus the name with MD5, v5 with SHA-1: same input, same output, every time — no lookup table, no stored mapping. Prefer v5 over v3: SHA-1 is stronger than MD5, and RFC 9562 recommends v5 for new implementations. The namespace separates uses: the same name under different namespaces yields different UUIDs. Versions 3 and 5 are wrong for random IDs: if the input is guessable, the output is guessable. When unpredictability matters, use v4 or v7.
MagiTool's UUID Generator produces UUIDs in bulk, and one click copies them, entirely in your browser: nothing is uploaded or stored. Before generating, decide on the version: v4 by default, v7 for database primary keys, v5 when you need to derive an ID stably from a name.
In theory yes; in practice, almost never. Version 4 has 122 random bits, a space so large that a collision in everyday use is negligible. What deserves worry is the generator itself: if the random source is weak, no amount of space helps. Never use a UUID as a password or a secret: RFC 9562 explicitly warns against assuming UUIDs are hard to guess.
Look at the first digit of the third group: 1 is v1, 4 is v4, 7 is v7. In 550e8400-e29b-41d4-a716-446655440000, the third group is 41d4, so it starts with 4 and is a v4 UUID. The first digit of the fourth group is the variant, and the mainstream values are 8, 9, a, and b. Those two digits are all you need.
Yes. The first 48 bits of a v7 UUID are a Unix timestamp in milliseconds, so anyone holding the ID can read its exact creation time without a database or an API call. If you would rather not reveal when the record was created, use v4 instead. Version 1 has the same problem, and worse: it also carries machine information.
It depends. Auto-increment IDs are short, readable, and naturally ordered, but they need a central issuer: in a distributed system, several machines issuing numbers at once will collide unless something coordinates them. UUIDs need no coordination — but they are longer, harder to read, and the random versions are unfriendly to indexes. Use auto-increment in a single application where it is enough; use UUIDs across services and machines, or when IDs must be generated offline, and prefer v7 for database primary keys.
No. Hexadecimal characters are case-insensitive: A and a are the same value. The standard form is lowercase, and most tools and databases output lowercase. Normalize to lowercase before comparing or deduplicating, so that 550E8400-... and 550e8400-... are not treated as two different IDs.
Yes. Without hyphens you get a 32-character hexadecimal string, a form many systems (especially databases and URL parameters) use to store UUIDs. The hyphenated form is the standard one, and the 32-character form is just another way to write the same value; converting between them loses nothing. Pick one form and use it consistently across the whole system instead of mixing them.