What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit number used to uniquely identify information in computer systems. The standard format is 32 hexadecimal digits displayed in five groups separated by hyphens: 550e8400-e29b-41d4-a716-446655440000. UUIDs are also known as GUIDs (Globally Unique Identifiers) in Microsoft terminology.
UUID Versions
- UUID v1: Based on timestamp and MAC address. Sortable but reveals machine identity and creation time.
- UUID v4: Randomly generated. Most commonly used — no identifiable information, purely random. This is what our generator produces.
- UUID v5: Name-based using SHA-1 hashing. Deterministic — same namespace + name always produces the same UUID.
Common Use Cases
- Database primary keys: UUIDs eliminate ID collisions in distributed systems and simplify merging records across databases.
- File names: Use UUIDs for temporary filenames or user uploads to avoid naming conflicts.
- API tokens: Generate unique identifiers for session tokens, request IDs, or idempotency keys.
- Testing: Quickly generate unique test data — user IDs, order numbers, or transaction references.
- Distributed systems: UUIDs let multiple services generate IDs independently without coordination.
💡 Pro Tip: UUIDs in REST APIs
When designing REST APIs, use UUIDs in URL paths instead of sequential IDs to prevent enumeration attacks. For example, /api/users/550e8400-e29b-41d4-a716-446655440000 is safer than /api/users/42 because attackers can't guess or iterate through UUIDs. Also, UUIDs let frontend clients generate IDs optimistically before the server confirms — perfect for offline-first apps and collaborative editing tools.
Frequently Asked Questions
Are UUIDs really unique?
UUID v4 generates 122 random bits. The probability of collision is approximately 1 in 2.7 × 1018 — for context, you'd need to generate 1 billion UUIDs per second for 85 years to have a 50% chance of a single collision. For practical purposes, they are unique.
UUID vs. auto-increment ID — which should I use?
Auto-increment IDs are smaller and faster for indexing but cause issues in distributed systems and expose record counts. UUIDs are larger (16 bytes) but work everywhere, hide record counts, and enable offline ID generation. Use UUIDs for distributed/multi-tenant systems; use auto-increment for simple single-database apps.
Is this tool's output cryptographically secure?
Yes. UUID v4 generation uses crypto.getRandomValues() — a cryptographically secure random number generator built into all modern browsers. The generated UUIDs are suitable for use as tokens, identifiers, and keys.
Does it work offline?
Yes. All UUID generation happens in your browser — no data is sent to any server. The tool works offline once the page is loaded.
How do I use UUIDs as primary keys in PostgreSQL?
PostgreSQL has native uuid column type. Create a table with CREATE TABLE users (id UUID PRIMARY KEY DEFAULT gen_random_uuid()). Unlike auto-increment integers, UUIDs avoid ID collisions in distributed setups and don't expose record counts. The 16-byte storage overhead is negligible for most applications.
UUID v4 vs v7 vs ULID — which should I use?
UUID v4 (random) is the safe default — what this generator produces. UUID v7 (RFC 9562) embeds a Unix timestamp in the first 48 bits, making IDs time-sortable and B-tree/PostgreSQL index-friendly without losing uniqueness. ULID is a 26-character alternative that's also time-sortable but uses Crockford base32, making it URL-safe and slightly shorter. For new projects with heavy writes, consider v7 or ULID. For general use, v4 remains perfectly fine and universally supported.