UUID Generator & Decoder

Generate a UUID online (v4 and v7), bulk generate, decode versions, and extract timestamps

Use this free online UUID generator (a uuid4 generator and GUID generator) to get a random UUID instantly. Generate a UUID v4 (random) or UUID v7 (timestamp-based) online with one click. Bulk generate up to 100 UUIDs, decode any UUID version, and validate format. 100% client-side, your data never leaves your browser. Learn what a GUID is →

From the blog
Consistent Core Pattern in Distributed Systems

How a small, strongly consistent cluster lets a huge data cluster coordinate itself without drowning in consensus

Read

Developer tools Latest posts Explainers

Click Generate to create a UUID

UUID Version Comparison

UUID Versions

v1Timestamp + MAC address
v3MD5 hash of namespace + name
v4Random (most widely used)
v5SHA-1 hash of namespace + name
v7Timestamp + random (new standard)

UUID v4 vs v7

Sortablev4: No, v7: Yes (time-ordered)
DB perfv4: Poor (random), v7: Great
Timestampv4: None, v7: Millisecond
Randomnessv4: 122 bits, v7: 74 bits
Best forv4: General, v7: Primary keys

UUID Guide

What is a UUID?

UUID (Universally Unique Identifier) is a 128-bit identifier standardized in RFC 9562. UUIDs are formatted as 32 hexadecimal digits in 5 groups separated by hyphens: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx, where M is the version and N indicates the variant.

UUIDs are used everywhere: database primary keys, API resource identifiers, session tokens, file names, and distributed system IDs. They can be generated independently on any machine without coordination.

UUID v4: Random

UUID v4 is the most widely used version. It fills 122 of the 128 bits with cryptographically secure random data (6 bits are reserved for version and variant). The probability of generating two identical v4 UUIDs is astronomically low: you would need to generate about 2.71 quintillion UUIDs for a 50% collision chance.

The generator above works as a uuid4 generator: click Generate (or Bulk Generate) to generate a random UUID online with no setup, then copy it with one click.

UUID v4 is suitable for most use cases but has one drawback: random values cause fragmentation in B-tree database indexes. For database primary keys, consider UUID v7 instead.

UUID v7: Timestamp-Based

UUID v7 is the newest version, combining a 48-bit Unix timestamp (millisecond precision) with random bits. This makes UUIDs both unique and chronologically sortable. Because new IDs are always greater than previous ones, they perform well as database primary keys without causing B-tree page splits.

UUID v7 is the recommended choice for new applications that need unique identifiers with natural time ordering. For more on time-sortable distributed IDs, see our post on How Snowflake IDs Work.

UUID vs Snowflake ID

  • Size: UUID is 128 bits (36 characters with hyphens). Snowflake ID is 64 bits (up to 19 digits).
  • Sortability: UUID v7 and Snowflake IDs are both time-sortable. UUID v4 is not.
  • Database performance: Snowflake IDs are more compact and efficient as primary keys. UUID v7 is a good middle ground.
  • Adoption: UUIDs are universally supported. Snowflake IDs require custom generation logic.

Use our Snowflake ID Decoder to decode Discord, Twitter, and Instagram IDs.

UUIDs as Primary Keys in Cloud Databases and Microservices

Many teams use UUIDs as primary keys in managed PostgreSQL or MySQL services because each service can mint IDs without a central allocator. That fits microservices and public APIs: a new row or resource gets a stable identifier before any cross-service round trip.

The tradeoff is index layout. Random UUID v4 keys scatter inserts across a B-tree; UUID v7 (or other time-ordered schemes) keeps new keys mostly at the end of the index. For how indexes behave on disk, see database indexing explained. When you are choosing a managed engine, PostgreSQL vs MongoDB vs DynamoDB compares common operational models; for a concrete production-style stack, Django and PostgreSQL from zero to production walks through a full relational setup.

For REST-style APIs, UUIDs also work well in URLs and JSON bodies as opaque resource IDs, as long as you treat them as strings and keep generation cryptographically sound (this tool uses crypto.getRandomValues() in the browser).

UUID Generator FAQ

How do I get a random UUID online?

Use this free online UUID generator to get a random UUID instantly. Click Generate to create a random UUID v4 (the default for most uuid4 generator use cases), or switch to UUID v7 for a timestamp-based ID. To generate a UUID online in bulk, use Bulk Generate to get up to 100 UUIDs at once and copy them all with one click. No signup is required and nothing is sent to a server.

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit identifier that is unique across space and time. It is displayed as 32 hex characters in 5 groups: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. UUIDs are used as database primary keys, API identifiers, and distributed system IDs.

What is the difference between UUID v4 and UUID v7?

UUID v4 uses 122 random bits, making each UUID unique but not time-sortable. UUID v7 combines a 48-bit timestamp with random bits, making UUIDs both unique and chronologically sortable. UUID v7 is better for database primary keys because sequential IDs improve index performance.

Is a UUID the same as a GUID?

Yes. GUID (Globally Unique Identifier) is Microsoft's term for UUID. They are the same 128-bit format. UUID is the standard term from RFC 9562. GUID is primarily used in .NET, SQL Server, and Windows APIs.

Can two UUIDs ever be the same?

Theoretically yes, but practically no. UUID v4 has 5.3 x 1036 possible values. You would need to generate about 2.71 quintillion UUIDs for a 50% collision chance. UUID collisions do not happen in practice.

Which UUID version should I use?

Use UUID v4 for general-purpose unique identifiers. Use UUID v7 for database primary keys, event IDs, or any case where time-ordering improves performance. UUID v7 is the recommended choice for new applications.

Why are random UUIDs bad for databases?

Random UUIDs (v4) cause poor B-tree index performance because new IDs insert at random positions, causing page splits and fragmentation. UUID v7 solves this with timestamp-prefixed IDs that are naturally sequential. See our Snowflake ID guide for more on this topic.

How do I extract a timestamp from a UUID?

UUID v1 and v7 contain embedded timestamps. Paste any UUID into the decoder above and it will automatically detect the version and extract the timestamp. For UUID v7, the first 48 bits encode Unix milliseconds.

Should I use UUIDs as primary keys in a managed cloud database?

Yes, if you need globally unique keys without coordination. Prefer UUID v7 (or another time-ordered scheme) for relational primary keys when index locality matters; UUID v4 is fine when insert order does not affect performance. Always align with your engine’s recommended types (e.g. UUID in PostgreSQL) and monitor index bloat like any other high-churn key.

Why do microservices and APIs use UUIDs as identifiers?

Each service can generate IDs locally, so creating a row or resource does not block on a shared sequence. That avoids single points of failure and eases merges across environments. UUIDs also make stable, opaque public IDs in URLs and JSON payloads.

Is it safe to generate UUIDs online?

Yes. This tool uses crypto.getRandomValues() for cryptographically secure random number generation. All UUIDs are generated entirely in your browser. No data is sent to any server.