When to use the UUID Generator
Database primary keys
Use v7 UUIDs as IDs that are unique across servers and still sort by creation time.
API and test data
Generate IDs for fixtures, mocks and sample JSON.
File and object names
Give uploads unique names that will never clash.
Correlation IDs
Tag requests so you can trace them through logs.
Features and benefits
- UUID v4 using the browser’s secure randomness
- UUID v7 with a millisecond timestamp for database-friendly ordering
- Up to 1,000 at a time
- Uppercase, no-hyphen and {braced} formats
Example
Version 7, 3 UUIDs
019a8f3e-6c21-7b4d-9f1a-2c7e5d0b8a41 019a8f3e-6c22-7e10-8a3c-…
How the UUID Generator works
Version 4 UUIDs come from crypto.randomUUID (or 16 secure random bytes with the version and variant bits set). Version 7 puts the current Unix time in milliseconds into the first 48 bits, sets the version bits to 7 and the variant bits as RFC 9562 requires, and fills the rest with secure random bits. When many v7 IDs are generated within one millisecond, ConvertNest steps the timestamp forward so they still sort in creation order.
A real-life example
A developer is building an orders table that will be written to from several servers. Auto-increment numbers would clash, but random v4 UUIDs would scatter new rows across the index and slow down inserts. He generates a few v7 UUIDs here to check the format his database library expects, then switches the library to UUID v7.
Good to know
A UUID (universally unique identifier, called a GUID in Microsoft tools) is a 128-bit number written as 32 hexadecimal characters in five groups. Version 4 UUIDs contain 122 random bits, so the chance of two ever colliding is negligible.
Version 7, standardised in RFC 9562 in 2024, starts with the current time in milliseconds followed by random bits. New IDs therefore sort in creation order, which keeps database indexes compact and fast, a common reason to prefer v7 for primary keys.
UUIDs reveal nothing secret, but v7 does reveal when it was created. Use v4 when you do not want the creation time to be visible.
Tips for the best results
- Choose v7 for database keys and v4 when the time should stay hidden.
- Keep the lowercase, hyphenated form unless a system requires another.
- Use the download for large batches of test data.
- Store UUIDs in a native UUID column type where available, it uses less space.
Common mistakes to avoid
Treating UUIDs as secrets
They are identifiers, not passwords. Use the Password Generator for secrets.
Mixing formats
Braced, uppercase and hyphen-less forms may not match in comparisons. Pick one format.
Using v1 for privacy-sensitive data
Older v1 UUIDs could include a device’s MAC address. v4 and v7 do not.
Which UUID version to use
Quick answer: use UUID v4 when you just need a random unique ID. Use UUID v7 for database keys, because v7 starts with a timestamp and sorts in creation order, which keeps indexes fast.
| Version | Based on | Sortable | Best for |
|---|---|---|---|
| v4 | Random numbers | No | Tokens, file names, general IDs |
| v7 | Unix time in milliseconds plus random bits | Yes | Database primary keys, event logs |
| v1 | Time and device MAC address | Partly | Old systems, avoid for privacy |
Details in UUID v4 vs v7.
UUID Generator, frequently asked questions
What is the difference between UUID and GUID?
They are the same thing. GUID is Microsoft’s name for a UUID.
Can two UUIDs ever be the same?
In practice, no. You would need to generate billions per second for many years to have a realistic chance of a v4 collision.
Which version should I use for database keys?
Version 7, because it sorts by time and keeps indexes efficient.
Are they generated on a server?
No. They are created in your browser.
Can I extract the time from a v7 UUID?
Yes. The first 12 hexadecimal digits are the Unix time in milliseconds.
Are the UUIDs unique across devices?
Yes, the random bits make collisions practically impossible.
Can two UUIDs ever be the same
In theory yes, but the chance for random v4 UUIDs is so small that you would need to generate billions per second for many years to expect one duplicate.
Is a UUID the same as a GUID
Yes. GUID is the name Microsoft uses for the same 128 bit identifier.