A dependable general-purpose choice when index order is not the main concern.
UUID v4 & v7 Generator
Generate one or a batch of random v4 or time-ordered v7 identifiers with the browser's cryptographic random source.
Random identifiers and time-ordered identifiers solve different problems
Version 4 is widely supported and does not intentionally encode a creation time. Version 7 places a millisecond Unix timestamp first, so newer values tend to sort after older values.
Useful when roughly chronological ordering or database insertion locality matters.
An identifier is not a security boundary
UUIDs can label records, but they do not authenticate a user, authorise a request or replace a uniqueness constraint.
Keep a unique constraint
Probability does not detect software faults or accidental reuse. Enforce uniqueness where duplicates matter.
Do not use as a secret
Always perform normal permission checks, even when a URL contains an unguessable-looking identifier.
Consider timestamp exposure
A public v7 value reveals an approximate creation time. Decide whether that metadata is acceptable.
Need help choosing?
Compare layouts, database behaviour, ordering and privacy trade-offs in the worked UUID v4 vs v7 guide.