Version:
Format:
🆔
Generated UUID
Click UUID to copy · UUID V4 · Random

The Identity Crisis That UUIDs Solve

Every record in every database needs an identifier. Sequential integers seem obvious — easy to generate, compact, readable. But they leak information: an attacker who knows that order 1042 exists can guess that orders 1041 and 1043 also exist. They reveal scale. They fail in distributed systems where multiple nodes generate IDs independently. And they require coordination: some central authority must hand out the next number.

UUIDs eliminate all three problems. A UUID v4 is 122 bits of cryptographic randomness — statistically impossible to guess, completely independent of where or when it was generated, and produced without any coordination between systems. Two separate servers generating IDs simultaneously will produce different UUIDs without any communication between them.

v4 vs v1 — Choosing the Right Version

The choice between UUID versions comes down to one question: do you care about sortability? UUID v4 is 122 bits of randomness — maximally unpredictable, ideal when the identifier should reveal nothing about its origin. Use v4 for API resource identifiers, idempotency keys, session tokens, and anywhere security or privacy matters.

UUID v1 encodes a timestamp at microsecond resolution. Records inserted in order produce UUIDs that sort roughly chronologically, which benefits clustered database indexes by reducing page splits. The tradeoff: time information is extractable from the UUID, and UUIDs generated in the same microsecond differ only in their random node bytes. For database keys where insert performance matters more than ID opacity, v1 is the right call. To hash UUID values for verification or comparison, use the Hash Generator.

The Format Variations and What Uses Them

The canonical UUID format is lowercase with hyphens: 550e8400-e29b-41d4-a716-446655440000. But different systems expect different forms. Microsoft Windows and COM GUIDs use curly braces: {550e8400-e29b-41d4-a716-446655440000}. Some database implementations store UUIDs as 32-character hex strings without hyphens to save space in fixed-length columns. URN format (urn:uuid:...) is used in XML and IETF protocol documents. This tool generates all variants with a single click.

Practical Uses Across Different Engineering Contexts

  • Database primary keys: UUID v4 primary keys work identically across PostgreSQL, MySQL, SQLite, and MongoDB without schema changes. They're portable between databases and safe to expose in URLs because they reveal nothing about your data volume or ordering.
  • Session tokens: UUID v4 values are genuinely unpredictable session identifiers — there is no way to guess a valid session ID by observing other sessions. Combine with the Hash Generator to produce HMAC-signed session tokens for additional verification.
  • Idempotency keys in API requests: Stripe, Twilio, and most payment APIs accept an idempotency key header. Generate a UUID v4 per API call — the server uses it to detect and ignore duplicate requests caused by network retries.
  • Correlation IDs in distributed tracing: Assign a UUID to every incoming HTTP request and propagate it through every downstream service call. When a request fails, the UUID ties together log entries from every service that processed it.
  • File naming for uploads: Replace user-provided filenames with UUIDs before storing files in object storage. Eliminates path traversal vulnerabilities and collisions from simultaneous uploads with the same original filename.
  • Test data seed files: Use bulk generation to produce UUIDs for fixture data. Consistent UUIDs in test fixtures make test assertions reliable across environments.

How Cryptographic Randomness Works Here

This tool uses the browser's Web Crypto API (crypto.getRandomValues()) rather than Math.random(). The distinction matters for security: Math.random() is a pseudorandom generator seeded in a predictable way, and its output can sometimes be predicted. crypto.getRandomValues() pulls entropy from the operating system's hardware-based random source — the same entropy pool used by /dev/urandom on Linux. This makes the generated UUIDs suitable for security-sensitive applications, not just as database keys.

Verified by ToollyX Team · Last updated June 2026

Frequently Asked Questions

Disclaimer: UUID v4 generation uses the Web Crypto API's crypto.getRandomValues(). Generated UUIDs are not stored or transmitted anywhere.