UUID Generator
💬 Comments
Frequently Asked Questions
What is the difference between UUID v1, v4, and v5? +
v1 is time-based (includes timestamp + MAC address — reveals system info). v4 is random (most common, cryptographically random). v5 is name-based using SHA1 hash (deterministic — same name always produces same UUID).
What is the probability of a UUID collision? +
For UUID v4, generating 1 billion UUIDs per second for 85 years gives a 50% chance of one collision. In practice, collisions are essentially impossible. You'd need ~2.7 quintillion UUIDs before a 50% collision probability.
Is UUID the same as GUID? +
Essentially yes. GUID (Globally Unique Identifier) is Microsoft's term for UUID. They use the same format (8-4-4-4-12 hex chars). Microsoft GUIDs are typically v4 random UUIDs with minor implementation differences.
Should I use UUID as a database primary key? +
UUIDs work well as primary keys for distributed systems (no coordination needed). The downside is index fragmentation due to randomness — consider ULID or UUID v7 for sequential UUIDs if performance is critical.
How do I generate a UUID in JavaScript? +
Modern browsers and Node.js 15+ support crypto.randomUUID() natively. For older environments use the uuid npm package: import { v4 as uuidv4 } from 'uuid'; const id = uuidv4();