Generate UUID v4 (random) and UUID v7 (timestamp-sortable) identifiers
122 bits of cryptographic randomness. Ideal for most use cases where temporal ordering doesn't matter. Industry standard, supported everywhere.
550e8400-e29b-41d4-a716-446655440000
Encodes a 48-bit Unix millisecond timestamp in the most-significant bits, making v7 UUIDs naturally sortable by creation time. Better for database primary keys (reduces index fragmentation).
018f8e3d-4b2a-7c1d-9f3e-1a2b3c4d5e6f
↑ First 12 chars encode the timestamp — UUIDs generated later will always sort higher.
crypto.getRandomValues()