A UUID (universally unique identifier) is a 128-bit value written as 36 characters like f47ac10b-58cc-4372-a567-0e02b2c3d479. Its whole point is that you can generate one anywhere, at any time, without a central authority, and be practically certain nobody else will ever generate the same one.
Which version do you want?
- v4 — random. The default for almost everything: database keys, API tokens, file names. If you are unsure, use v4.
- v7 — time-ordered. Like v4 but sortable by creation time, which keeps database indexes tidy. A great modern default if your tools support it.
- v1 — based on time and a machine identifier. Mostly legacy; it can leak the timestamp and MAC address.
How to generate one
- Open the UUID generator.
- Pick the version (v4 is fine for most needs) and how many you want.
- Copy them out. They are generated on your device using the browser's secure random source.
When a UUID is the wrong tool
UUIDs are long and not human-friendly, so they make poor public-facing codes like order numbers or coupon codes — a short, readable code is better there. And because v4 is random, using it as a primary key can fragment a database index; that is exactly the problem v7 was designed to fix.