Online UUID Generator | Generate UUIDs v1, v3-v7 for Free

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit identifier used in computer systems for uniquely identifying information. UUIDs are standardized by RFC 4122, and thanks to their enormous entropy, they guarantee a practically zero probability of collision – meaning that two independently generated UUIDs will almost certainly be unique.

A UUID has a standard format: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f), M indicates the UUID version, and N indicates the variant.

UUID Versions

UUID v1 (Timestamp + MAC Address)

UUID v1 is based on the current timestamp and a random value (in browsers, instead of a MAC address). It uses 100-nanosecond intervals since October 15, 1582 (Gregorian calendar).

Usage:

  • Situations where you need chronological sorting of UUIDs
  • Debugging and logging (UUID contains information about creation time)
  • Distributed systems with time synchronization

Example: 6ba7b810-9dad-11d1-80b4-00c04fd430c8

Advantages:

  • UUIDs can be sorted chronologically by creation time
  • Useful for auditing and debugging
  • Contains timestamp information

Disadvantages:

  • Potential security risk – contains a timestamp
  • In browsers, it does not contain a real MAC address (replaced by a random value)
  • Poor DB locality (timestamp is in low-order bits)

UUID v3 (MD5 hash)

UUID v3 is generated using an MD5 hash of a namespace UUID and a name. It’s deterministic – the same namespace + name will always produce the same UUID.

Usage:

  • Converting URLs, DNS names, or other identifiers to UUIDs
  • Situations where you need reproducible UUIDs
  • Mapping between different identification systems

Example: a3bb189e-8bf9-3888-9912-ace4e6543002

Advantages:

  • Deterministic (same input = same output)
  • Ideal for converting known identifiers
  • No collision for different inputs

Disadvantages:

  • MD5 is an outdated algorithm (prefer v5)
  • Requires a namespace and a name
  • Cannot retrieve the original input

The most commonly used UUID version. UUID v4 is generated purely randomly using a cryptographically secure random number generator (crypto.getRandomValues()).

Usage:

  • Database primary keys
  • Session IDs
  • Unique file names
  • API tokens
  • General purposes where you need a guaranteed unique ID

Example: f47ac10b-58cc-4372-a567-0e02b2c3d479

Advantages:

  • Maximum entropy and security
  • No dependency on time or system parameters
  • Simplest implementation

Collision Probability: When generating 1 billion UUIDs per second for 100 years, the chance of a collision is approximately 0.00000006%.

UUID v5 (SHA-1 hash)

UUID v5 is similar to v3, but uses SHA-1 instead of MD5. A more modern and secure alternative to v3.

Usage:

  • Same as v3, but with better security
  • Preferred over v3 for new projects
  • Generating UUIDs from URLs, DNS names, OIDs, X.500 DN

Example: 886313e1-3b8a-5372-9b90-0c9aee199e5d

Advantages:

  • Deterministic
  • SHA-1 is more robust than MD5
  • Suitable for mapping between systems

Disadvantages:

  • SHA-1 is also considered outdated (but still more secure than MD5)
  • Requires a namespace and a name

UUID v6 (Ordered Timestamp)

UUID v6 is an enhanced version of v1 with reordered time bits for better database indexing. Designed to address locality issues in databases.

Usage:

  • Database primary keys with time-ordering
  • Systems requiring chronological ordering and DB performance
  • A more modern alternative to v1

Example: 1ec9414c-232a-6b00-b3c8-9e6bdeced846

Advantages:

  • Better DB locality than v1 (timestamp in high-order bits)
  • Chronological ordering
  • Compatible with UUID standard

Disadvantages:

  • Less commonly used than v1/v4
  • Still contains time information (security risk)

UUID v7 (Unix timestamp)

UUID v7 uses a Unix timestamp (milliseconds since 1970) + random bits. It’s the newest UUID version with the best database locality.

Usage:

  • Modern database primary keys
  • Systems requiring performance + time ordering
  • Replacement for v1/v6 in new projects

Example: 017f22e2-79b0-7cc3-98c4-dc0c0c07398f

Advantages:

  • Best DB locality among all versions
  • Unix timestamp is standard
  • Combines the benefits of randomness and time ordering

Disadvantages:

  • Relatively new specification (RFC 4122bis)
  • Less supported in legacy systems

Which UUID Version to Use?

Decision Guide

Do you need maximum security and randomness? → Use UUID v4 (most common choice)

Do you need time ordering and DB performance? → Use UUID v7 (modern) or UUID v6 (standard)

Do you need reproducible UUIDs from existing identifiers? → Use UUID v5 (SHA-1) or UUID v3 (MD5, legacy)

Do you need a timestamp and an audit trail? → Use UUID v1 (legacy, poorer DB performance)

Databases

For new projects: UUID v7 or v4

  • v7 is ideal for time ordering + performance
  • v4 for maximum randomness without time information

For legacy systems: UUID v1 or v6

  • v6 has better DB locality than v1
  • v1 is widely supported

Advantages of UUID as a primary key:

  • Global uniqueness – You can merge data from different databases without conflict
  • Security – Unlike sequential IDs (1, 2, 3…), future values cannot be guessed
  • Distributed systems – UUIDs can be generated independently on multiple servers without coordination
  • Database merging – No conflicts arise when merging two databases

Disadvantages:

  • Larger size (16 bytes vs 4-8 bytes for integer)
  • Slower indexing in some databases (use v6/v7 for better performance)
  • Less human-readable

API and Web Services

  • REST API – Unique identifiers for resources
  • GraphQL – Global identifiers for nodes
  • Webhooks – Tracking requests and responses
  • Tokens – Session IDs, refresh tokens

Files and Storage

  • File names – Preventing collisions during upload
  • S3/Cloud Storage – Unique paths to objects
  • Cache keys – Identifiers in cache systems

Frontend Applications

  • React/Vue components – Unique keys for lists
  • Temporary IDs – IDs before saving to the database
  • Local storage – Keys for stored data
  • Offline-first applications – Generating IDs without server connection

Advanced Generator Features

Generating UUIDs with Custom Time

For time-based versions (v1, v6, v7), you can select any timestamp using the date-time picker. This is useful for:

Testing:

  • Simulating UUIDs created in the past
  • Testing time-ordering in databases
  • Reproducing UUIDs for debugging

Data Migration:

  • Generating UUIDs with historical timestamps
  • Backfilling data with correct timestamp values
  • Importing data from different time periods

Audit and compliance:

  • Reconstructing UUIDs based on record creation time
  • Retroactive identifier generation

Example usage:

  1. Select version v1, v6, or v7
  2. Set the date and time using the date-time picker
  3. Generate UUIDs with your custom timestamp

Hash-based UUID (v3, v5)

For deterministic UUIDs, you can use versions v3 (MD5) or v5 (SHA-1):

How to use:

  1. Select a namespace according to the type of your identifier
  2. Enter the name/value
  3. Generate the UUID

Examples:

NamespaceName (input)Usage
DNSexample.comConvert domain name to UUID
DNSgoogle.comEach website has a unique UUID
URLhttps://example.com/pageConvert URL to UUID
URLhttps://api.example.com/users/123API endpoint as UUID
OID1.3.6.1.4.1.343Object Identifier to UUID
X.500CN=John Doe,O=CompanyDistinguished Name to UUID

Important properties:

  • Deterministic: Same input = always same UUID
  • Reproducible: You can recreate the UUID anytime
  • Consistent: Same UUID across different systems
  • Cannot decode: Original name cannot be retrieved from UUID
  • ℹ️ Single UUID: For v3/v5, only one UUID is generated (same input = same output)

Practical usage:

// Example: Convert URL to UUID v5
Namespace: URL
Name: https://example.com/api/users/123
Result: 886313e1-3b8a-5372-9b90-0c9aee199e5d

// Same input = always same UUID
Namespace: DNS
Name: google.com
Result: always the same UUID for google.com

How to Safely Use UUIDs?

Cryptographic Security

Our generator uses crypto.getRandomValues(), which is a cryptographically secure random number generator. Unlike Math.random(), which is predictable and unsuitable for security purposes, crypto.getRandomValues() provides real entropy suitable for:

  • Generating security tokens
  • Session IDs
  • API keys
  • Cryptographic applications

Comparison of UUID Versions

VersionBasisCollisionsTime-OrderingDB PerformanceUsage
v1Timestamp + MACLow✅ Yes❌ WorseLegacy, audit
v3MD5 hashNone (deterministic)❌ No⚠️ MediumConversions (legacy)
v4RandomExtremely low❌ No⚠️ MediumGeneral purpose
v5SHA-1 hashNone (deterministic)❌ No⚠️ MediumConversions (recommended)
v6Ordered timestampLow✅ Yes✅ BetterModern DBs with time
v7Unix timestampLow✅ Yes✅ BestNew projects

UUID vs Other Identifiers

TypeSizeCollisionsTime-OrderingUsage
Auto-increment ID4-8 bytesGuaranteed unique within tableSimple apps, local DB
UUID v416 bytesPractically impossibleDistributed systems, API
UUID v716 bytesPractically impossibleModern DBs with performance
ULID16 bytesPractically impossibleUUID + lexicographical sorting
Snowflake ID8 bytesGuaranteed unique with proper configTwitter, distributed systems
NanoIDConfigurableDepends on lengthURL-friendly IDs

Implementation in Different Languages

JavaScript/TypeScript

// UUID v4 - Easiest way (modern browsers)
const uuid = crypto.randomUUID();

// UUID v4 - Manual implementation
function generateUUIDv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    const r = (crypto.getRandomValues(new Uint8Array(1))[0] & 0x0f) >> (c === 'x' ? 0 : 2);
    const v = c === 'x' ? r : (r & 0x3) | 0x8;
    return v.toString(16);
  });
}

// UUID v7 - Recommended for databases
function generateUUIDv7() {
  const timestamp = Date.now();
  const timeHi = (timestamp >> 16).toString(16).padStart(8, '0');
  const timeLow = (timestamp & 0xFFFF).toString(16).padStart(4, '0');

  const randomBytes = crypto.getRandomValues(new Uint8Array(10));
  const randomHex = Array.from(randomBytes)
    .map(b => b.toString(16).padStart(2, '0'))
    .join('');

  return `${timeHi}-${timeLow}-7${randomHex.substr(0, 3)}-${randomHex.substr(3, 4)}-${randomHex.substr(7)}`;
}

Python

import uuid

# UUID v4
uuid_v4 = str(uuid.uuid4())
# Output: '6ba7b810-9dad-11d1-80b4-00c04fd430c8'

# UUID v1
uuid_v1 = str(uuid.uuid1())

Java

import java.util.UUID;

// UUID v4
String uuidV4 = UUID.randomUUID().toString();

PHP

// UUID v4 (PHP 7+)
function generateUUID() {
    return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
        mt_rand(0, 0xffff), mt_rand(0, 0xffff),
        mt_rand(0, 0xffff),
        mt_rand(0, 0x0fff) | 0x4000,
        mt_rand(0, 0x3fff) | 0x8000,
        mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
    );
}

C#

using System;

// UUID v4
Guid uuid = Guid.NewGuid();
string uuidString = uuid.ToString();

Best Practices

Storing UUIDs in a Database

PostgreSQL:

CREATE TABLE users (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    email VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT NOW()
);

MySQL 8.0+:

CREATE TABLE users (
    id BINARY(16) PRIMARY KEY DEFAULT (UUID_TO_BIN(UUID())),
    email VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Tip: In MySQL, store UUIDs as BINARY(16) instead of CHAR(36) to save space and for faster indexing.

UUID Validation

function isValidUUID(uuid) {
  const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
  return regex.test(uuid);
}

UUID Conversion

// Remove hyphens
const compact = uuid.replace(/-/g, '');

// Add hyphens back
function formatUUID(compactUuid) {
  return [
    compactUuid.substring(0, 8),
    compactUuid.substring(8, 12),
    compactUuid.substring(12, 16),
    compactUuid.substring(16, 20),
    compactUuid.substring(20, 32)
  ].join('-');
}

Troubleshooting

UUID v3/v5 is not working

Problem: After selecting v3 or v5, nothing is generated

Solution:

  1. ✅ Check that you have filled in the “Name” field - it is mandatory!
  2. ✅ Select the correct namespace based on your input type
  3. ✅ Examples of valid inputs:
    • DNS: example.com, google.com
    • URL: https://example.com/page
    • Any text: my-application-v1

Tip: Try a simple value like test and the DNS namespace first.

Time-based UUID (v1, v6, v7) has a strange time

Problem: The generated UUID has an unexpected timestamp

Solution:

  1. ✅ Check the date-time picker - is the correct time set?
  2. ✅ The date-time picker uses your local timezone
  3. ✅ Leave the date-time picker empty for the current time

UUID cannot be copied

Problem: The “Copy All” button does not work

Solution:

  1. ✅ Check that you have generated UUIDs (they are not empty)
  2. ✅ Some browsers require HTTPS for the clipboard API
  3. ✅ Alternatively, select the text in the textarea and copy manually (Ctrl+C)

Frequently Asked Questions (FAQ)

Can UUID collisions occur? Theoretically yes, but the probability is astronomically small. When generating 1 billion UUID v4s per second for 100 years, the chance of a collision is approximately 0.00000006%. In practice, a collision will almost never happen.
Is UUID suitable as a primary key in a database? It depends on the use case. UUID is ideal for distributed systems and situations where you need global uniqueness. For simple applications with a single database, auto-increment might be more efficient.
Are UUIDs generated by this tool secure? Yes, we use the Web Crypto API (`crypto.getRandomValues()`), which provides cryptographically secure random values. Everything happens locally in your browser.
What is the difference between UUID versions? - **v1**: Timestamp + MAC/random - chronological sorting, poorer DB performance - **v3/v5**: Hash-based - deterministic, for converting known identifiers - **v4**: Random - most secure, most commonly used - **v6**: Reordered timestamp - better DB performance than v1 - **v7**: Unix timestamp - best DB performance + time ordering
Which UUID version should I use? For most cases, use **v4** (random). For databases with time ordering, use **v7** (modern) or **v6** (standard). For converting known identifiers (URL, DNS), use **v5** (SHA-1).
Can I use UUIDs for tokens and API keys? UUID v4 is suitable for session IDs and similar tokens. For API keys, consider using longer random strings (e.g., 256-bit values) or specialized libraries.
How large are UUIDs? A UUID is 128 bits (16 bytes). In string format with hyphens, it takes up 36 characters. Without hyphens, it's 32 hexadecimal characters.

Alternatives to UUIDs

ULID (Universally Unique Lexicographically Sortable Identifier)

  • 128-bit ID (same as UUID)
  • Lexicographically sortable by creation time
  • More compact representation (26 characters instead of 36)
  • Case-insensitive base32 encoding

Example: 01ARZ3NDEKTSV4RRFFQ69G5FAV

NanoID

  • Smaller size than UUID (21 characters by default)
  • URL-friendly (no special characters)
  • Faster generation
  • Configurable length and alphabet

Example: V1StGXR8_Z5jdHi6B-myT

Snowflake ID (Twitter)

  • 64-bit ID (smaller than UUID)
  • Time-sortable
  • Contains worker ID and sequence number
  • Requires centralized configuration

Example: 1234567890123456789

Performance and Optimization

Generation Speed

Our generator can generate:

  • 1 UUID: < 1 ms
  • 100 UUIDs: ~10-20 ms
  • 1000 UUIDs: ~100-200 ms

Performance Tips

  1. Batch Generation – If you need many UUIDs, generate them all at once instead of one by one
  2. Storing in DB – Index UUID columns for fast lookups
  3. Compression – Store UUIDs in binary form (16 bytes) instead of a string (36 bytes)
  4. Caching – In some cases, you can pre-generate and cache UUIDs

For Developers

UUID v4 Structure

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
|        |    |    |    |
|        |    |    |    └─ 48 bits of random data (node)
|        |    |    └────── 16 bits of random data with variant (clock_seq)
|        |    └─────────── 12 bits of random data + 4 bits of version (time_hi_and_version)
|        └──────────────── 16 bits of random data (time_mid)
└───────────────────────── 32 bits of random data (time_low)
  • Version (4 bits): always 0100 (binary) = 4 (hex)
  • Variant (2-3 bits): always 10 (binary) for RFC 4122

Testing UUIDs

// Jest test
describe('UUID Generator', () => {
  test('generates valid UUID v4', () => {
    const uuid = generateUUIDv4();
    const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
    expect(regex.test(uuid)).toBe(true);
  });

  test('generates unique UUIDs', () => {
    const uuid1 = generateUUIDv4();
    const uuid2 = generateUUIDv4();
    expect(uuid1).not.toBe(uuid2);
  });
});

Security Aspects

What NOT to Do with UUIDs

Do not use UUID v1 for sensitive applications – It contains a timestamp, which can be a security risk

Do not use Math.random() to generate UUIDs – It is not cryptographically secure

Do not rely on UUIDs for authorization – UUIDs can be guessed (though with an extremely low probability)

Do not store UUIDs in cookies without encryption – Use signed cookies or JWTs

What to DO

Use UUID v4 for most cases – Highest entropy and security

Combine UUIDs with other security measures – For session management, use HTTPS, HttpOnly cookies, and short expiration

Validate UUIDs on the server – Always check the format and version of the UUID

Use cryptographically secure random number sourcescrypto.getRandomValues() in the browser, /dev/urandom on Linux

Interesting Facts

  • Number of possible UUID v4s: 2^122 ≈ 5.3 × 10^36 (340 undecillions)
  • Collision needed: For a 50% chance of collision, you need to generate 2.71 × 10^18 UUIDs (2.71 quintillions)
  • Size of all possible UUIDs: If we stored each UUID as 16 bytes, the entire space would occupy 85 zettabytes (85 billion terabytes)
  • Origin: UUID was standardized as part of the DCE (Distributed Computing Environment) in 1990