UUID guides

The background behind our UUID generator. What a UUID is, how the versions differ, whether they can collide, and how to use them as database keys.

8 articles, newest first

  • · 3 min read

    How to Validate a UUID with Regex, Plus Why You Might Not Want To

    A correct regular expression for UUID validation, with variants for specific versions, braces and uppercase, and the built in parsers that are usually a better choice.

    validation regex

  • · 4 min read

    Can Two UUIDs Collide? The Math Behind Uniqueness

    How likely is a UUID v4 collision really? We work through the birthday problem with real numbers so you can stop worrying, and cover the rare ways collisions actually happen.

    uniqueness maths uuid v4

  • · 3 min read

    UUID vs GUID: Is There Any Difference?

    GUID is Microsoft's name for a UUID. They are the same 128 bit format, with one byte order quirk in .NET and SQL Server that can bite you.

    guid .net basics

  • · 3 min read

    How to Generate a UUID in JavaScript, Python, Go, Java, C# and SQL

    Copy and paste snippets for generating UUID v4 and v7 in JavaScript, Node, Python, Go, Java, C#, PostgreSQL, MySQL and the command line.

    javascript python java go sql

  • · 4 min read

    Should You Use UUIDs as Database Primary Keys?

    The real trade offs of UUID primary keys in PostgreSQL and MySQL: storage size, index fragmentation, security, and why UUID v7 changes the answer.

    database keys postgresql mysql performance

  • · 4 min read

    All UUID Versions Explained: v1 to v8

    UUID version fields explained, including RFC 9562 layouts, DCE v2, Nil and Max. Learn what each encodes and choose a version for your task.

    uuid versions rfc 9562

  • Featured · 4 min read

    UUID v4 vs v7: Which One Should You Use?

    UUID v4 is random, UUID v7 is time ordered. See how each is built, how they affect database indexes, and a simple rule for picking one.

    uuid v4 uuid v7 database keys

  • · 4 min read

    What Is a UUID? A Plain English Guide

    Learn what a UUID is, what the 36 character format means, how UUIDs reduce collision risk without a central server, and when you should use one.

    basics uuid format

Choose a guide for your task

For a new identifier field, start with what a UUID is. It introduces the string layout, version field and the difference between a random value and one based on a name or timestamp. That background helps you read a value without assuming it proves identity, permission or the exact order of events. If you only need test data, the generator is available without completing the reading list.

The v4 versus v7 comparison is the next step when you are choosing a database key. Use it to compare random identifiers with an encoded timestamp, then read the primary key article for storage and index tradeoffs. A timestamp can group nearby values, but concurrent writers, clock changes and the generator affect insertion order. Run a workload that resembles your own database before treating locality as a throughput result.

For uniqueness questions, use the collision probability article. It states the random bit assumptions behind the birthday calculation and separates an unlikely random collision from a broken generator or repeated source value. Keep a uniqueness constraint when your application needs it. If you require the same output for the same input, read the version overview and the name based examples instead of assuming a random version can provide that behavior.

The generation guide collects runnable calls for languages and databases, while the validation guide separates a string pattern from version and variant checks. Use the linked language page for runtime requirements and the validator to inspect a value you already have. The browser generator supports v1, v3, v4, v5, v6 and v7, plus nil and max. Choose a version for its properties, generate a small sample and verify how your application stores, sorts and displays it before importing a batch.

← All articles

↑ Top