UUID Generator

Generate Unique Identifiers

Generate UUID

What is a UUID?

UUID (Universally Unique Identifier) is a 128-bit label used to identify information in computer systems. They follow RFC 4122 with several versions, each with different generation methods.

UUID Versions Explained

UUID v1 (Timestamp) xxxxxxxx-xxxx-1xxx-xxxx-xxxxxxxxxxxx Embeds timestamp and MAC address. Sortable but exposes node information.
UUID v4 (Random) xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx Most common version. Random generation means negligible collision probability.
UUID v7 (Unix Epoch) xxxxxxxx-xxxx-7xxx-xxxx-xxxxxxxxxxxx Combines Unix timestamp with randomness. Sortable and privacy-preserving.

When to Use Each UUID Type

  • v4: General-purpose identifiers for databases, sessions, and any case where privacy matters.
  • v1: Legacy systems needing chronological ordering. Use cautiously due to MAC exposure.
  • v7: Modern apps needing time-sortable IDs without v1's privacy issues. Ideal for distributed systems.

Security Considerations

UUID v4 is not cryptographically secure. Do not use standard UUIDs for security tokens or cryptographic keys. Use dedicated CSPRNG libraries instead.

Frequently Asked Questions

What is the collision probability for UUID v4?Approximately 1 in 5.3 x 10^36. Even generating 1 billion UUIDs per second for 100 years yields less than 0.001% collision chance.
Can UUIDs be used as database primary keys?Yes, especially in distributed systems. UUID v7 is recommended for indexed columns due to its time-ordered structure.
Are UUIDs cryptographically secure?No. UUID v4 uses pseudo-random generation, not cryptographic randomness. Use CSPRNG for security tokens.
Which version is best for database indexes?UUID v7. Its time-ordered structure allows sequential B-tree fills, reducing index fragmentation and improving insert performance.
Can UUIDs be converted between versions?No. Each version has a different structure and algorithm. Generate a new UUID with the desired version.
What does the version number mean?The version byte (position 13) indicates the generation method: v1=timestamp+MAC, v4=random, v7=Unix epoch+random.