SnapSum
← Back to Blog
Developer3 min read

UUID Generator - What Is a UUID and When to Use It

UUIDs (Universally Unique Identifiers) are 128-bit identifiers used everywhere in software - database primary keys, API resource IDs, session tokens, and distributed systems. If you have seen a string like 550e8400-e29b-41d4-a716-446655440000, that is a UUID.

What Makes a UUID Unique?

A UUID has 128 bits (32 hex characters in 5 groups). The chance of a random collision is about 1 in 5.3 x 10^36 - essentially zero for any practical application. You can generate billions of UUIDs per second and never get a duplicate.

UUID Versions Explained

  • v1 - timestamp + MAC address. Leaks the machine identity. Rarely used today.
  • v3 - MD5 hash of a namespace + name. Deterministic (same input = same UUID).
  • v4 - random. The most common version. Used by default in most generators. 122 random bits.
  • v5 - SHA-1 hash of a namespace + name. Like v3 but more secure.
  • v7 - timestamp-ordered + random. New standard (RFC 9562, 2024). Sortable by time. Recommended for new systems.

When to Use UUIDs

  • Database primary keys - avoid sequence guessing and collisions across shards
  • API resource IDs - /api/users/550e8400-... instead of sequential /api/users/42
  • Distributed systems - generate IDs without a central coordinator
  • Session tokens - unpredictable, hard to guess
  • File names - avoid collisions when multiple users upload photo.jpg

UUID v4 vs. v7 - Which to Choose?

  • v4 - fully random, no ordering. Good for general use.
  • v7 - time-ordered prefix + random suffix. Better for databases (sequential inserts = less index fragmentation). The modern choice for new projects.

Free Online UUID Generator

Use SnapSum UUID Generator to generate UUIDs in your browser - no network needed after page load, no account, no tracking.

  • Generate v4, v5, and v7 UUIDs
  • Batch generate (1-100 at once)
  • One-click copy individual or all UUIDs
  • Works offline after initial page load

Step-by-Step: Generate UUIDs

  1. Open UUID Generator.
  2. Select UUID version (v4, v5, or v7).
  3. Choose how many to generate (1-100).
  4. Click "Generate" and copy your UUIDs.

UUIDs vs. Sequential IDs

FeatureSequential IDUUID
GuessableYes (/user/42)No
Distributed-safeNo (needs central DB)Yes
DB index perfExcellentGood (v7 better)
Storage size4-8 bytes16 bytes (128-bit)