What Is a UUID? Format and Structure Explained#
A UUID (Universally Unique Identifier) is a 128-bit value used to identify information without a central coordinating authority. Every UUID is represented as 32 hexadecimal characters split into five groups by hyphens, following the pattern 8-4-4-4-12. A typical UUID looks like this: 550e8400-e29b-41d4-a716-446655440000.
The format is defined in RFC 4122 and is supported natively by virtually every programming language, database system, and operating system. UUIDs are designed so that any two independently generated values are, for all practical purposes, guaranteed to be different — even when generated simultaneously on different machines with no communication between them.
UUID v4: How Random Generation Works#
UUID version 4 is by far the most commonly used variant. It is generated by filling 122 of the 128 bits with random data (the remaining 6 bits are reserved for version and variant flags). The result is a UUID that is essentially random, with no embedded timestamp, machine identifier, or sequential component.
The number of possible UUID v4 values is 2122, approximately 5.3 × 1036. To put collision probability in perspective: if you generated one billion UUIDs every second for the next 100 years, the probability of generating a single duplicate would still be less than 0.00000000006%. For practical engineering purposes, UUID v4 values are unique. Use a UUID generator to create them instantly without writing any code.
When to Use UUIDs vs Auto-Increment IDs#
Auto-increment integers (1, 2, 3…) are simple and efficient in a single database with a single writer. UUIDs are better in several situations:
- Distributed systems — multiple services or database shards can generate IDs independently without risk of collision or the need for a centralised sequence
- Merging databases — when combining two datasets, integer IDs will collide; UUIDs will not
- Security — sequential integer IDs leak information (e.g. a competitor can tell how many orders you've processed); UUIDs do not
- Client-generated IDs — a mobile app or frontend can assign a UUID before the record hits the server, enabling optimistic UI updates
UUID vs GUID: Are They the Same Thing?#
Yes, with a minor historical footnote. GUID (Globally Unique Identifier) is Microsoft's name for the same concept. The underlying format and RFC are identical — a GUID is a UUID, just with a different name. Microsoft introduced the term in the context of COM (Component Object Model) in the 1990s; RFC 4122 formalised the UUID specification in 2005.
In practice: if you are working with Microsoft SQL Server, .NET, or Windows APIs, you will see "GUID" everywhere. If you are working with most other languages, databases, or standards, you will see "UUID." They are interchangeable. A UUID generated by a Python script can be stored in a SQL Server GUID column without any conversion.
Generating UUIDs in JavaScript, Python, and Other Languages#
Most modern languages provide UUID generation in their standard library or a widely-used package:
- JavaScript (Node.js) —
crypto.randomUUID()is built into Node 14.17+ and modern browsers; or use theuuidnpm package - Python —
import uuid; str(uuid.uuid4())— no third-party package needed - PHP —
Str::uuid()in Laravel, or use theramsey/uuidlibrary - Go — the
github.com/google/uuidpackage is the standard choice - PostgreSQL —
SELECT gen_random_uuid();— built in since PostgreSQL 13 - MySQL / MariaDB —
SELECT UUID();— generates a v1 UUID (time-based); use a v4 function if randomness is required
Common UUID Use Cases#
UUIDs show up across almost every area of backend and frontend development:
- Database primary keys — especially in distributed or multi-tenant architectures
- Session tokens — a UUID is harder to guess than a sequential session ID, reducing session hijacking risk
- File names — uploaded files stored with UUID names avoid naming conflicts without complex deduplication logic
- Idempotency keys — APIs use client-provided UUIDs to detect duplicate requests (e.g. "this payment was already processed")
- Correlation IDs — assigning a UUID to each incoming request lets you trace that request across multiple microservices in log files
- Draft content — create a record with a UUID before the user saves, enabling auto-save and recovery
Using the Free UUID Generator at allio.tools#
The UUID generator at allio.tools generates RFC 4122-compliant v4 UUIDs in the browser. You can generate between 1 and 100 UUIDs at a time, choose whether to display them in uppercase or lowercase, and copy the entire batch to the clipboard in one click. No account, no sign-up, no rate limits.
The generation happens entirely in your browser using the Web Crypto API — the UUIDs are never sent to a server, which matters if you are generating IDs for sensitive records or internal systems. If you also need to hash data or convert timestamps, the hash generator and timestamp converter are in the same developer toolset.