Abstract network of glowing hexagonal identifier tags connected by thin lines on a dark background, illustrating unique IDs

A UUID is a 128-bit identifier that is practically unique — generate one anywhere, any time, and it will almost certainly never collide with another. It looks like this: 550e8400-e29b-41d4-a716-446655440000. That string of 32 hexadecimal digits, split into five groups, is the standard way to give something an ID without asking a central server first.

Developers use UUIDs as database keys, file names, session tokens, and API identifiers — anywhere a unique value must be created offline, on any machine, without coordination. This guide explains the format, compares the versions, gives you the real collision odds in plain language, and shows you how to make one online, in code, or from the command line.

What Does a UUID Look Like?

A UUID is 36 characters long, counting its four hyphens: eight digits, then groups of four, four, four, and twelve. Each character is a hexadecimal digit — 0 to 9 or a to f — so a UUID holds 122 random bits in version 4. Two digits are not random at all: the version digit tells you which kind it is, and the variant digit marks the layout. In 550e8400-e29b-41d4-a716-446655440000, the 4 after the second hyphen says version 4.

UUID Generator Online: Make One in Seconds

The fastest way to get a UUID is an online UUID generator: open the page, and a fresh version 4 UUID is waiting for you. Press generate again for another, and copy the one you need. No signup, no install, nothing to configure. For a single ID in a test file, a config, or a database row, that is the whole job — and the generator is free, so there is no reason to type 32 hex digits by hand.

UUID Versions Compared

UUIDs come in versions, and the version decides how the bits are filled. Version 1 mixes a timestamp with a machine address; version 4 is fully random; version 5 is a hash of a name; version 7, the newest, is time-ordered for databases. For most work, version 4 is the default choice, and version 7 is the one to reach for when rows must sort by creation time.

Version How it is made Best for Notes
v1 Timestamp + MAC address Legacy systems Reveals time and machine
v4 122 random bits Almost everything The default choice
v5 SHA-1 hash of a name Same input, same ID Deterministic, not random
v7 Timestamp + random bits Database keys Sorts by creation time

The standard behind all of this is RFC 9562, which replaced the older RFC 4122 and added versions 6, 7, and 8. If you want the exact bit layout, the RFC is the authority — but for day-to-day work, knowing v4 is random and v7 is time-ordered covers almost everything.

How Likely Is a UUID Collision?

Here is the plain-language answer: you would need to generate about 2.7 quintillion version 4 UUIDs — that is 2.7 billion billion — before the chance of a single collision reaches 50%. Generate a billion UUIDs and the chance of any two matching is still far below one in a billion. In practice, collisions do not happen by accident; they happen when a generator is broken, or when someone reuses a fixed UUID as a placeholder.

The maths behind that is the birthday paradox: with 2^122 possible values, the collision chance grows with the square of how many you generate, not linearly. That is why 122 bits is so much safer than it sounds — doubling the bits squares the safety. If your system generates a million UUIDs a second, it would still take roughly 85,000 years to reach that 50% mark.

How to Generate a UUID in Code

Every major language has a UUID function built in, so you rarely need a library. In Python, the uuid module makes a version 4 ID in one line. In modern JavaScript, crypto.randomUUID does the same in the browser and in Node. Both use your system's cryptographic random source, so the result is as random as a UUID can be. The MDN page for crypto.randomUUID shows the exact call and its browser support.

# Python — generate a version 4 UUID
import uuid
print(uuid.uuid4())
# 550e8400-e29b-41d4-a716-446655440000

// JavaScript — in the browser or Node
crypto.randomUUID();
// "550e8400-e29b-41d4-a716-446655440000"

// Command line (macOS and Linux)
$ uuidgen
550E8400-E29B-41D4-A716-446655440000

When to Use a UUID — and When Not To

Use a UUID when an ID must be created without a central counter: database rows written offline, files uploaded from many devices, or events from distributed systems. JSON data is a common home for them — a UUID field in a JSON object identifies a record anywhere it travels, which is why a JSON formatter is handy when you inspect that data.

Just remember the limits: a UUID is not a password, not a secret, and not a security token. Anyone who sees it can use it, so never treat it as proof of identity. And if you need a short, human-friendly ID — an order number, a ticket code — a UUID is the wrong tool: 36 characters of hex is overkill when a short code would do.

UUID vs Auto-Increment IDs: Which Should You Pick?

The main rival to a UUID is the auto-increment integer: 1, 2, 3, handed out by the database. Integers are shorter, faster to index, and easier to read — but they reveal how many rows you have, and they need a central counter, so two offline systems can hand out the same number. A UUID costs more storage and looks ugly in a URL, but it works anywhere, with no coordination.

Pick integers for a single database; pick UUIDs when IDs are created in many places at once.

Frequently Asked Questions

What is an online UUID generator?

A free web page that creates a version 4 UUID in one click, with no signup or install. Open it, copy the UUID, and paste it where you need an ID — a database row, a config file, or a test. For bulk IDs, generate them in code instead: Python's uuid module or JavaScript's crypto.randomUUID make as many as you need.

What is the difference between UUID v1 and v4?

Version 1 mixes a timestamp with a machine address, so it reveals when and where it was made. Version 4 is fully random, with 122 random bits. Use v4 unless you need time-ordering — then version 7, the newer time-ordered format, is the better choice.

Can two UUIDs ever be the same?

In theory, yes; in practice, no. You would need about 2.7 quintillion version 4 UUIDs before the chance of one collision reaches 50%. Accidental collisions do not happen with a working generator — if you see a duplicate, the generator or the data is broken.

How do I generate a UUID in Python?

Import the uuid module and call uuid.uuid4(): print(uuid.uuid4()) gives you a fresh version 4 UUID. For a name-based ID that is the same every time, uuid.uuid5(uuid.NAMESPACE_DNS, 'example.com') returns a deterministic version 5 UUID.

Is a UUID the same as a GUID?

Almost. A GUID is Microsoft's name for the same 128-bit format, and most GUIDs are version 4 UUIDs. The difference is mostly history and naming: the UUID standard is RFC 9562, while GUIDs come from Microsoft's COM world. In practice, you can treat them as the same thing.

By Rahib Ali