What is UUID?

A UUID, or Universally Unique Identifier, is a 128-bit value that is used to identify objects or entities in a distributed computing environment. A UUID is designed to be unique and highly unlikely to be duplicated or collide with another UUID. UUID can be generated using different algorithms and are represented as a 32-character hexadecimal string.

Why do we need UUID?

In a distributed computing environment, there may be multiple machines that need to access the same object or entity. Without a unique identifier, it would be difficult to ensure that each machine is accessing the correct object or entity. UUID provide a way to uniquely identify objects and entities across multiple machines.

How are UUID generated?

UUID can be generated using different algorithms, including Version 1, Version 2, Version 3, Version 4, and Version 5 UUID. Each version uses a different algorithm to generate a unique identifier.

Version 1 UUID use a combination of the current time and the MAC address of the computer generating the UUID. This makes them unique within the context of a particular computer and at a particular time.

Version 2 UUID are similar to Version 1 UUID, but include additional information such as the user's ID and the user's group ID.

Version 3 UUID use a hashing algorithm to generate a unique identifier based on a namespace and a name.

Version 4 UUID use a random or pseudo-random number generator to generate a unique identifier. This is the most commonly used type of UUID.

Version 5 UUID are similar to Version 3 UUID but use a different hashing algorithm.

Probability of UUID duplication

While UUID are designed to be unique, it is important to note that the probability of a UUID being duplicated is not zero. The probability of a collision occurring between two Version 4 UUID generated from independent systems is extremely low, with the chance of a collision being around 1 in 2 to the power of 122, or approximately 5.3 x 10^-37. However, the probability of a collision can increase in scenarios where a large number of UUID are being generated or in cases where UUID are being generated on the same system. In such cases, it may be necessary to implement additional measures to ensure the uniqueness of UUID, such as checking against a database or using a different UUID version.

What is the format of a UUID?

A UUID is represented as a 32-character hexadecimal string, with each group of characters separated by a hyphen. The groups are separated into five parts and the format is format is: 8-4-4-4-12, which means it has 8 digits in the first group, 4 digits in the second, third, and fourth groups, and 12 digits in the final group. The total number of characters in a UUID is 36, including the four hyphens.


UUID are a unique identifier that is used to identify objects and entities in a distributed computing environment. They can be generated using different algorithms and are represented as a 32-character hexadecimal string. The most commonly used type of UUID is Version 4 UUID, which is generated using a random or pseudo-random number generator. The format of a UUID includes five parts, representing the time, clock sequence, node, and reserved fields.