UUID Generator

Generate random UUID v4 or time-ordered UUID v7 identifiers, ULIDs or short Nano IDs, one at a time or up to a thousand at once. Paste an existing ID to find out its version and when it was created.

IDs
Decode an ID

Which ID should I use?

TypeExampleBest for
UUID v49b2e…-4c1a-…The universal default. 122 random bits, supported by every database and language. Doesn't reveal when it was made.
UUID v70192…-7b3c-…Database primary keys. It starts with a timestamp, so new rows are inserted in order, which keeps B-tree indexes compact and fast. Standardised in RFC 9562 (2024).
ULID01J8Z3…Sortable IDs that are shorter (26 characters), case-insensitive and URL-safe. Popular in event logs and distributed systems.
Nano IDV1StGXR8_Z5jdHi6B-myTShort IDs in URLs, such as share links or invite codes. The default 21 characters are about as collision-resistant as a UUID v4.

UUID v4 vs UUID v7 for primary keys

Random v4 UUIDs land all over the index, so each insert touches a different page. On large tables that means more disk reads, page splits and a bloated index. UUID v7 puts a millisecond timestamp in the first 48 bits, so new keys arrive in order, much like an auto-increment number, while still being unique across servers without coordination. PostgreSQL 18 adds a built-in uuidv7() function, and libraries exist for Java, .NET, Go and Python.

The catch: a v7 UUID reveals roughly when the record was created. If that matters, for example for user IDs in public URLs, use v4.

How unique is a UUID?

A version 4 UUID has 122 random bits. You would need to generate about a billion UUIDs per second for around 85 years before the chance of a single duplicate reached 50%. In practice, a bug in how the random numbers are produced is a far bigger risk than a collision. This page uses your browser's cryptographically secure generator (crypto.getRandomValues).

Generating UUIDs in code

Frequently asked questions

What is the difference between a UUID and a GUID?

They are the same thing. GUID is Microsoft's name for a UUID. GUIDs are often written in uppercase and wrapped in braces, which you can switch on above.

Can I tell when a UUID was created?

Only for time-based versions. Paste a v1, v6 or v7 UUID, or a ULID, into the decoder to see its timestamp. Version 4 UUIDs are fully random and contain no time.

Are UUID v7 IDs from this page sortable?

Yes. IDs generated in the same millisecond use an increasing counter, so a batch sorts in exactly the order it was created. ULIDs work the same way.

Should I store UUIDs as text or binary?

Use the database's native type when there is one (PostgreSQL uuid, SQL Server uniqueidentifier). Otherwise store 16 bytes in a binary column; text takes 36 bytes and compares more slowly.

Are the IDs sent anywhere?

No. They are generated in your browser and never leave your device.