UUID Generator

UUID Generator

The UUID generator generates version 4 UUID string using a cryptographically-strong random number generator. UUIDs generated from this app are RFC-4122 compliant. The UUIDs generated by this app are provided "AS IS", without warranty of any kind.


Similar Tools

Date to Timestamp
Time Epoch Converter
URL Encoder
URL Decoder

About UUID Generator

UUID (universally unique identifier) also known as GUID (globally unique identifier) is a 128-bit, 36-character alphanumeric identifier used in computer systems and softwares for uniqly identifying an object. It is considered that the chance of duplication in UUID is negligible or near to zero and hence it is widely used for ID generation in Databases and other software systems.

The chances of generating duplicate UUIDs are so low that separate computers can generate UUIDs at the same time with no communication and still be confident the UUIDs are unique. Independent systems that use UUIDs can be safely merged at any time without worrying about collisions.

UUID can be generated by any programming language and even online tools will always generate a globally unique identifier.

UUID Generator - FAQs

UUIDs are 128-bit, 36-character long alphanumeric string composed of 5 groups of hexadecimal digits seperated by hyphen. The length of each group is: 8-4-4-4-12. It has 32 alphanumeric characters and 4 hyphens. The 128-bit is divided into 32 hex digits x 4 bits per hex digit = 128-bits.

There are several types (versions) of UUIDs available -

UUID version 1 and version 2 also called time based UUID. These are generated using a combination of system's datetime value, a random number and part of system's mac address.

UUID version 3 and version 5 are generated by hashing a namespace identifier and name. Version 3 uses MD5 hashing and version 5 uses SHA-1 hashing algorithm. They are similar to time-based UUIDs but instead of using system's datetime value and mac address they instead rely on namespace data and name data. The namespace data is itself a UUID, and the name data could really be any arbitrary string, although in practice it typically relates to how the UUID will be used – it might be an account name, for example, or a product ID.

UUID version 4 is purely random based and hence it is extremly difficult to identify information about the source by looking at the version 4 UUID. Each character in version4 UUID is simply a random character from a-z or integer from 0-9.

In JavaScript: Use the following code to generate UUID in JavaScript

1. Install the uuid package

                npm install uuid
              

2. Generate UUID in JavaScript

                import { v4 as uuidv4 } from 'uuid';
                uuidv4();
              

In Java: Use the following code to generate UUID in Java

The Java language has built-in support for generating Version 4 UUIDs using Utils package.

1. Generate UUID in Java

                import java.util.UUID;

                class generateUUID {
                    public static void main(String[] args) {
                        UUID uuid = UUID.randomUUID();
                        String uuidString = uuid.toString();
                        System.out.println("Your UUID is: " + uuidString);
                    }
                }
              

The chances of UUID collision are scarce in all the different versions. In version 1, it is based on the device's mac address, which is unique on every computer with a network card. The timestamp is also included in the UUID to ensure uniqueness—the timestamp field will roll over in 5236 AD. So there is no chance of duplicate until then.

In UUID version 4, which is based on the randomness of every character in the UUID string, there are approximately 5.3 x 10^36 possible UUID combinations. With numbers that large the chances of any two people in the whole world ever generating the same UUID are astronomically small.

In UUID version-3 and version-5, the output is based on the input you provide. As long as the input provided is random, the chances of duplication are very very rare.

If you are unsure about which version of UUID is good for your use case, always go for version 4. It is more than sufficient and it practically provides collision free unique ID.