UUID Generator

Generate unique UUIDs (Universally Unique Identifiers) for databases, APIs, and applications. Support for v1 and v4.

Generate UUIDs

About UUID v4

A UUID (Universally Unique Identifier) is a 128-bit number used to identify information in computer systems.

UUID v4 uses random or pseudo-random numbers. The chance of collision is extremely low:

  • Total possible UUIDs: 2122 ≈ 5.3 × 1036
  • Collision probability with 1 billion UUIDs: ~0.00000000000000000001%

Common Uses:

  • Database primary keys
  • Session identifiers
  • Unique file names
  • API request tracking
  • Distributed systems coordination

What It Does

A UUID Generator creates Universally Unique Identifiers (UUIDs), also known as GUIDs (Globally Unique Identifiers). UUIDs are 128-bit numbers used to uniquely identify information in computer systems without requiring a central coordination authority. They're essential for distributed systems, databases, and APIs where generating unique IDs independently across multiple systems is necessary. The 128-bit format provides such a large number space that the probability of collision (generating the same ID twice) is negligibly small, making UUIDs perfect for creating unique record identifiers, session IDs, transaction IDs, and more.

Key Features:

  • Generate multiple UUIDs instantly (v1 and v4 variants)
  • UUID v4: Random cryptographically strong identifiers
  • UUID v1: Time-based identifiers with MAC address component
  • Bulk generation: create 1, 10, 50, or 100 UUIDs at once
  • Multiple format options: standard, compact, URN, and hex
  • Copy individual UUIDs or entire batch with one click
  • Validation of existing UUID strings
  • UUID parsing to see version and variant information

How To Use

Generate unique identifiers for your databases, APIs, and applications in seconds. Whether you need a single UUID or hundreds, our generator provides cryptographically secure identifiers instantly.

1

Select UUID Version

Choose between UUID v4 (random, most common) or UUID v1 (timestamp-based). v4 is recommended for most use cases as it provides better privacy and doesn't expose your MAC address.

2

Choose Quantity

Select how many UUIDs you need. You can generate 1, 10, 50, 100, or any custom amount. Bulk generation is useful for database seeding or batch operations.

3

Pick Format

Choose your preferred format: standard (8-4-4-4-12 with hyphens), compact (no hyphens), URN format (urn:uuid: prefix), or hex string. Standard format is most commonly used.

4

Generate UUIDs

Click the generate button to create your UUIDs. Each generated UUID is guaranteed to be unique with a collision probability of virtually zero.

5

Copy and Use

Copy individual UUIDs or the entire list. Paste them into your database schemas, API responses, configuration files, or wherever unique identifiers are needed.

Pro Tips

  • Use UUID v4 for general purposes - it's the most widely supported
  • Store UUIDs as binary (16 bytes) in databases for better performance
  • Use lowercase for consistency unless your system requires uppercase
  • Generate UUIDs in bulk for database seeding to save time
  • Don't use UUIDs as encryption keys - they're identifiers, not secrets
  • Consider using UUID v7 (time-sortable) for better database indexing if available

Benefits

Generate IDs without database coordination or auto-increment
Prevent ID collision in distributed systems and microservices
Create offline - no network or database connection required
Merge data from multiple sources without ID conflicts
Improve security by using non-sequential IDs
Support database sharding and horizontal scaling
Enable client-side ID generation in web and mobile apps
Maintain uniqueness across different environments (dev, staging, production)

Use Cases

Database Primary Keys

Use UUIDs as primary keys in databases for globally unique records that can be generated client-side or across distributed databases.

CREATE TABLE users (id UUID PRIMARY KEY, ...)

API Resource Identifiers

Generate unique identifiers for RESTful API resources, ensuring URLs remain unpredictable and secure.

GET /api/users/550e8400-e29b-41d4-a716-446655440000

Session and Token IDs

Create unique session identifiers, request IDs, or correlation IDs for tracking requests through distributed systems.

Set-Cookie: sessionId=123e4567-e89b-12d3-a456-426614174000

File and Document Naming

Generate unique filenames for uploaded files to prevent overwriting and ensure uniqueness.

Save uploaded file as 7c9e6679-7425-40de-944b-e07fc1f90ae7.pdf

Microservices Communication

Track transactions and messages across microservices with correlation IDs for distributed tracing.

X-Correlation-ID: a8098c1a-f86e-11da-bd1a-00112444be1e

Database Seeding

Generate UUIDs in bulk for seeding test databases with realistic data structures.

Create 1000 test records with unique UUID identifiers

Code Examples

Standard UUID v4 Format

8-4-4-4-12 format with hyphens (most common)

text
550e8400-e29b-41d4-a716-446655440000

PostgreSQL Usage

Using UUID as primary key in PostgreSQL

sql
CREATE TABLE users (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email VARCHAR(255)
);

Node.js Generation

Generating UUID v4 in Node.js

javascript
const { v4: uuidv4 } = require('uuid');
const userId = uuidv4();
console.log(userId);

Frequently Asked Questions

1 What's the difference between UUID v1 and v4?
UUID v1 is time-based and generated using the current timestamp plus the computer's MAC address, making it sortable by creation time but potentially exposing hardware information. UUID v4 is randomly generated using cryptographically strong random numbers, providing better privacy and security. v4 is recommended for most use cases: database IDs, API resources, and session tokens. Use v1 only when you need time-based sorting or chronological ordering of IDs. Note that v1 can reveal when and where (which machine) the UUID was generated, which may be a privacy concern.
2 Are UUIDs truly unique? Can collisions happen?
While theoretically possible, UUID collisions are astronomically improbable. The UUID space has 2^122 possible values (for v4), which is approximately 5.3 × 10^36 unique IDs. To put this in perspective, generating one billion UUIDs per second for 100 years would yield a collision probability of about 50% only after generating 2.7 × 10^18 UUIDs. For practical purposes, UUIDs are unique. However, ensure you're using a proper cryptographically secure random number generator (CSPRNG) for v4 UUIDs, as weak randomness can increase collision risk.
3 Should I use UUIDs or auto-incrementing integers as database IDs?
Both have trade-offs. UUIDs provide: global uniqueness, offline generation, better security (non-sequential), and easier data merging. However, they use more storage (16 bytes vs 4-8 bytes), are slower to index, and aren't human-readable. Auto-increment integers are: smaller, faster to index, human-readable, and sequential. Use UUIDs for: distributed systems, microservices, client-side ID generation, public-facing IDs, or when merging databases. Use integers for: single-database applications, when performance is critical, or when you need easily memorable IDs. Some systems use both: UUID for public-facing IDs and auto-increment for internal joins.
4 How should I store UUIDs in databases?
Store UUIDs as binary (16 bytes) rather than strings (36 bytes) for better performance and storage efficiency. Most databases support native UUID types: PostgreSQL has UUID type, MySQL has BINARY(16), SQL Server has UNIQUEIDENTIFIER. This reduces index size by more than 50%, improves query performance, and saves storage space. When retrieving, convert binary to string format for display. For MySQL without native UUID support, store as BINARY(16) and use UUID_TO_BIN() and BIN_TO_UUID() functions. Always index UUID columns if used as primary keys or frequently queried.
5 Can I use UUIDs for security tokens or API keys?
While UUIDs are unique and unpredictable (v4), they're not designed as cryptographic secrets. UUIDs have only 122 bits of randomness (v4), which is less than the 128+ bits recommended for cryptographic keys. For security tokens, API keys, or authentication secrets, use dedicated cryptographic functions that generate tokens with at least 128 bits of cryptographically secure random data. UUIDs are perfect for resource identifiers, correlation IDs, and database keys, but use proper token generation libraries (like crypto.randomBytes()) for security-sensitive applications.

Related Tools