Generate cryptographically secure random UUID v4 and time-ordered UUID v7 unique identifiers.
A Universally Unique Identifier (UUID) is a 128-bit label standardized by RFC 4122 and RFC 9562 used to uniquely identify records across distributed computing systems without requiring centralized coordination.
Standard UUIDs are formatted as 32 hexadecimal digits displayed in five groups separated by hyphens (`8-4-4-4-12`), totaling 36 characters (e.g., `123e4567-e89b-12d3-a456-426614174000`). UUID v4 uses 122 bits of cryptographically secure pseudo-randomness. UUID v7, standardized in RFC 9562, combines a 48-bit Unix epoch millisecond timestamp with 74 bits of random data, making it naturally time-ordered and optimal for database primary key indexing.
Traditional auto-incrementing integer database IDs expose business metrics and risk sequential enumeration attacks. UUID v4 provides collision-free global uniqueness across distributed microservices. However, because UUID v4 values are random, using them as primary keys in B-tree database indexes causes severe index fragmentation. UUID v7 solves this by embedding millisecond timestamps at the start of the ID, maintaining sequential B-tree insertion locality while guaranteeing global uniqueness.
// UUID v4 (Cryptographically Random) f47ac10b-58cc-4372-a567-0e02b2c3d479 // UUID v7 (Time-Ordered Timestamp + Randomness) 019114f0-42ab-7210-9081-3f412ab34567
The probability of a collision among 2.3 billion UUID v4 values is approximately 1 in a billion, making collisions practically impossible in real-world software applications.
UUID v7 embeds a millisecond Unix timestamp at the beginning of the ID, ensuring new records are inserted sequentially at the end of database B-tree indexes rather than causing random page splits.
Yes. OwnFormatters uses the browser's native `crypto.getRandomValues()` Web Crypto API to guarantee cryptographic entropy.