UUID generator

Fresh random v4 or time-ordered v7 UUIDs, one or a thousand at a time, formatted the way your code wants them.

How a UUID is laid out

A UUID is 128 bits written as 32 hex digits in groups of 8-4-4-4-12. The first digit of the third group is the version (4 or 7 here) and the first digit of the fourth group is the variant (8, 9, a or b for standard UUIDs). In v7 the first 48 bits are the Unix time in milliseconds, which is why v7 IDs made a second apart share their first few characters. To match UUIDs in text, see the UUID regex.

In code

crypto.randomUUID()                 // browsers & Node 19+: v4
import uuid; uuid.uuid4()           # Python
uuid.uuid7()                        # Python 3.14+
SELECT gen_random_uuid();           -- PostgreSQL 13+ (v4); uuidv7() in PostgreSQL 18

Questions

Should I use UUID v4 or v7?

v4 is 122 random bits — ideal when IDs must reveal nothing. v7 (RFC 9562, 2024) starts with a millisecond timestamp, so new IDs sort in creation order; that keeps database B-tree indexes compact and is now the usual choice for primary keys. v7 does reveal roughly when the ID was created.

Are these UUIDs random enough?

Yes. They come from crypto.getRandomValues, the browser's cryptographically secure generator. With v4 you would need to generate about a billion per second for 85 years to reach a 50% chance of one collision.

What is the difference between a UUID and a GUID?

None in practice. GUID is Microsoft's name for the same 128-bit identifier; Windows tools often show it uppercase and in braces, which you can switch on here.

Are they generated on a server?

No — in your browser. Nothing is logged or sent.