How to use the GUID generator
- Pick UUID v4 for random IDs (the usual choice), UUID v7 for IDs that sort by creation time, or ULID for a shorter, time-sortable alternative.
- Enter how many you need (1–1,000) and press Generate.
- Choose uppercase, remove hyphens for a 32-character string, or add braces for the Windows GUID style.
- Copy the list or download it as a text file, one ID per line.
Anatomy of a random UUID v4
A UUID is 128 bits written as 32 hex digits in groups of 8-4-4-4-12. Two places carry fixed meaning. The first digit of the third group is the version, so every v4 UUID has a 4 there. The first digit of the fourth group holds the variant, which for standard UUIDs is always 8, 9, a or b:
xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx
│ └── variant: 8, 9, a or b
└─────── version: 4The other 122 bits are random, giving 2122 (about 5.3 × 1036) possible values. That is why randomly generated v4 IDs can be treated as unique in practice, provided the random source is good. Browsers' crypto.randomUUID() and crypto.getRandomValues() are cryptographically secure; Math.random() is not and should never be used to create UUIDs. The layout is specified in RFC 9562, section 5.4.
UUID v7 and ULID: time-ordered IDs
Random v4 keys land all over a database index, which can slow inserts on very large tables. Version 7 (RFC 9562, section 5.7) fixes that by putting a 48-bit Unix timestamp in milliseconds at the front, followed by random bits. New IDs therefore sort after older ones. When you generate several in the same millisecond, this tool adds a counter so the list is still in creation order. Paste a v7 UUID into the validator to read back the moment it was created.
A ULID uses the same idea, a millisecond timestamp plus 80 random bits, but writes it as 26 characters of Crockford Base32 (for example 01ARYZ6S41TSV4RRFFQ69G5FAV), as described in the ULID specification. ULIDs are not UUIDs, but they store in the same 128 bits.
Create a UUID in code
JavaScript crypto.randomUUID()
Node.js require('node:crypto').randomUUID()
Python import uuid; str(uuid.uuid4())
Java java.util.UUID.randomUUID().toString()
C# Guid.NewGuid().ToString()
PostgreSQL SELECT gen_random_uuid();
macOS/Linux uuidgenTo validate a UUID in code, a regular expression such as ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ (case-insensitive) checks the format, version and variant. You can try it in the regex tester. Time-based versions embed a timestamp you can compare with the epoch converter.