About the UUID generator
A UUID (universally unique identifier), also called a GUID, is a 128-bit ID written as 36 characters, such as 3f2b8c1e-9a4d-4e7b-b1c2-5d6e7f8a9b0c. UUIDs let you create IDs for database rows, files, events and API requests without asking a central server for the next number.
This tool generates version 4 UUIDs, which are made from random numbers produced by your browser's cryptographically secure random generator.
How to use the UUID generator
- Choose how many UUIDs you need in the Count menu: 1, 5, 10, 25, 50 or 100.
- Click Generate UUIDs.
- Click Copy result to copy them, one per line.
- Click Generate UUIDs again whenever you need a fresh set.
Example
Generate 3 UUID v4 values
Input
Count: 3Output
3f2b8c1e-9a4d-4c7e-8f21-6b0d5e9a3c47
9e7d1a52-0c3b-4f8a-b6e4-2d91c8f07a13
c41f6e08-5b2a-47d9-9e3c-8a7b0f1d2e65Example output; every run gives new random values. The 4 at the start of the third group marks version 4.
Common errors and how to fix them
crypto.randomUUID is not a function
crypto.randomUUID() only exists in secure contexts (HTTPS or localhost) and in Node.js 14.17 or newer. Serve the page over HTTPS, or use the uuid package on older runtimes.
invalid input syntax for type uuid
PostgreSQL rejected the value because it isn't a 36-character UUID. Check for extra quotes, whitespace or braces, and that the value has five hyphen-separated groups.
Duplicate key value violates unique constraint on a UUID column
Random v4 UUIDs practically never collide, so the same value was inserted twice by the code, for example a default created once at startup instead of per row.
Good to know
- UUIDs are generated in lowercase, the standard format. Most systems accept either case.
- Version 4 UUIDs are random, so they don't sort by creation time. If your database index needs time-ordered IDs, look at UUID v7.
- A UUID is an identifier, not a secret. Don't use one as a password or security token.
Frequently asked questions
Can two UUID v4 values ever be the same?
In theory yes, but it is extremely unlikely. A v4 UUID has 122 random bits; you would need to generate billions of UUIDs per second for many years before a duplicate became likely.
What is the difference between a UUID and a GUID?
They are the same thing. GUID is the name Microsoft uses; UUID is the name used in the official standard.
What does the 4 inside the UUID mean?
The first character of the third group is the version number. In every v4 UUID it is 4, and the first character of the fourth group is 8, 9, a or b.