Developer

UUID Generator

Generate up to a thousand identifiers at once, in the format your database or config file wants. The random bits come from your browser's cryptographic generator, not from Math.random. Paste an existing UUID at the bottom to see what version it is and when it was made.

v4 is the default nearly everywhere. v7 starts with a timestamp, so a list of them sorts into creation order.

Between 1 and 1000.

Format

Lowercase with hyphens is the canonical form. The rest exist because Windows and XML each wanted their own.

Inspect a UUID

    What the 32 digits are holding

    A UUID is 128 bits, written as 32 hexadecimal digits in the 8-4-4-4-12 pattern that makes it 36 characters with the hyphens. Two small regions of those bits are not payload. Four bits say which version generated it, and two or three more mark the variant, which says whose layout rules apply. That leaves 122 bits for a version 4 UUID to be random in.

    The version nibble is the thirteenth hex digit — the one right after the second hyphen. In a v4 UUID it is always 4, which is why so many UUIDs you see have a 4 sitting in that position. The variant shows up as the seventeenth digit being 8, 9, a or b. Those two facts are all the inspector above is really doing.

    v4 or v7

    Version 4 is pure randomness and has been the sensible default for twenty years. Version 7 was standardised in RFC 9562 in 2024, alongside v6 and v8, replacing the older RFC 4122. It puts a 48-bit Unix timestamp in milliseconds at the front and fills the rest with random bits.

    The reason to care is database indexes. A v4 primary key lands at a random point in the index on every insert, so the database is constantly splitting pages it has not touched recently and reading them back from disk. A v7 key appends, because each new value is larger than the last, so inserts concentrate on the pages already in memory. On a table with millions of rows this is the difference between an index that fits in cache and one that does not.

    The cost of v7 is that it tells everyone when the row was created, to the millisecond. If the identifier is public and the creation time is not something you want published — an order ID that reveals your sales rate, for instance — that is a real leak, and v4 is the right choice.

    Collisions, and why nobody worries about them

    With 122 random bits, you would need to generate roughly 2.7 quintillion v4 UUIDs before reaching a 50% chance of a single collision anywhere in the set. That is the birthday bound, not a guarantee, and it holds only if the bits are genuinely random. This tool takes them from crypto.getRandomValues, the browser's cryptographic generator.

    The failure mode that actually happens is a bad random source. Several older JavaScript libraries built UUIDs out of Math.random, which is fast, predictable and never intended for this. Those UUIDs look identical to good ones — the version nibble is still a 4 — and no inspector can tell them apart. If you inherited a codebase generating UUIDs by hand, that is worth checking.

    Do not use a UUID as a secret

    A v4 UUID has enough entropy to be unguessable, so the temptation to use one as a password reset token or an unlisted share link is understandable. Two problems. Anything below v4 is not random at all — a v1 UUID exposes a timestamp and often a MAC address, and v3 and v5 are hashes of a name you may be able to guess. And UUIDs are treated as identifiers throughout most systems, which means they end up in logs, in analytics, in Referer headers and in support tickets. Generate tokens with a tool meant for secrets.

    Storing them

    A UUID is 16 bytes. Stored as CHAR(36) it takes 36, and every index on it grows accordingly. PostgreSQL has a native uuid type that stores the real 16 bytes; MySQL does not, so BINARY(16) with conversion at the edges is the usual answer. Keep the text form lowercase and hyphenated, because that is the canonical representation and mixed casing turns equality comparisons into a bug hunt.

    What this tool does not generate

    The inspector has a limit worth naming too: it reads bits and nothing else. Any 32 hex digits with a plausible version and variant will be reported as a valid UUID, because that is all a UUID is. It cannot tell you whether the thing was generated properly, or whether it means anything in your system.

    Frequently asked questions

    What is the difference between a UUID and a GUID?

    Nothing meaningful. GUID is the name Microsoft uses for the same 128-bit identifier, sometimes written in braces and uppercase. The inspector above reads both, and the variant field is the only place the legacy Microsoft layout shows up.

    Should I use UUID v4 or v7 for a database primary key?

    v7, in almost every case. Its timestamp prefix means inserts append to the end of the index instead of scattering across it, which keeps the hot pages in memory. Choose v4 instead when the creation time must stay private.

    Can two UUIDs ever be the same?

    In principle yes, in practice no. Reaching a 50% chance of one collision takes around 2.7 quintillion v4 UUIDs, assuming a proper random source. A weak generator, such as one built on Math.random, is the realistic risk.

    Is a UUID safe to use as a security token?

    No. Use a generator built for secrets instead. Even a v4 UUID is treated as an identifier by everything downstream, so it leaks into logs, analytics and referrer headers, and older versions contain a timestamp or a MAC address rather than randomness.

    Why does every UUID I see have a 4 in the same place?

    That digit is the version field, and version 4 is the most common kind. The digit after the third hyphen is the variant, which is why so many UUIDs also have an 8, 9, a or b there.

    Last updated September 19, 2026