What a UUID is
A UUID (Universally Unique Identifier), also called a GUID, is a 128-bit value written as 32 hexadecimal digits in five dash-separated groups: 8-4-4-12. Version 4 UUIDs are almost entirely random — only a few bits are fixed to mark the version and variant:
The 4 marks version 4, and y is one of 8, 9, A or B (the variant). The other 122 bits come from a secure random source, giving an enormous space of possible values.
Worked example
Reading a generated UUID like 3f2504e0-4f89-41d3-9a0c-0305e82c3301:
4 → version 4 (random).9 (8/9/a/b) → RFC 4122 variant.Are collisions possible?
In theory, yes — but the odds are astronomically small. With 122 random bits there are about 5 × 10³⁶ possible v4 UUIDs. You'd need to generate billions per second for many years before the chance of any two matching became meaningful. For database keys, file names, session IDs and test data, v4 UUIDs are treated as effectively unique without coordination between systems.