Ttooleras
🆔

UUID Generator

Generators

Generate UUID v4, v1, v7 and GUIDs — bulk or single, instantly. Free, private — all processing in your browser.

Click "Generate" to create UUIDs
Advertisement

The UUID Generator creates Universally Unique Identifiers (UUIDs, also called GUIDs — Globally Unique Identifiers) in every version developers actually use: UUID v4 (random, the most common), UUID v1 (timestamp + MAC-based), and UUID v7 (timestamp-ordered, the new standard for databases and distributed systems). Generate one UUID or bulk-generate up to 1,000 at a time for database seeding, test fixtures, or batch imports. Every UUID is created locally in your browser using the Web Crypto API — nothing touches our servers.

UUIDs are the universal solution for distributed unique identifiers. Unlike auto-increment integers, UUIDs can be generated independently on any machine — laptops, serverless functions, mobile apps — without coordination, and the probability of collision is astronomically small. This makes UUIDs the default primary key for modern applications, especially those using microservices, event sourcing, offline-first mobile clients, or distributed databases like MongoDB, DynamoDB, and CockroachDB. A UUID is 128 bits long, encoded as 32 hexadecimal digits displayed in 5 hyphen-separated groups of 8-4-4-4-12 characters, for example 550e8400-e29b-41d4-a716-446655440000.

UUID Generator — key features

UUID v4 (random) — the default

The most common UUID type. 122 random bits, collision probability near zero. Use it for primary keys, session IDs, correlation IDs, and any unique identifier that does not need ordering.

UUID v1 (timestamp + MAC)

Legacy format that includes a timestamp and node (MAC) identifier. Sequential but leaks MAC address. Mostly kept for backward compatibility.

UUID v7 (sortable, RFC 9562)

The new standard for databases. Millisecond Unix timestamp + random bits — lexicographically sortable by time. Dramatically improves B-tree index performance over v4.

Bulk generation

Generate up to 1,000 UUIDs at once. Export as plain text, JSON array, SQL INSERT statements, or CSV. Perfect for seeding test data.

Multiple output formats

Lowercase (standard), uppercase, with braces (Microsoft GUID format), or without hyphens (compact 32-character hex). Copy whichever format your system expects.

Instant generation in browser

No server round-trip. Uses Web Crypto API for cryptographic randomness. Works offline once the page is loaded.

Copy and download

Copy to clipboard with one click or download as .txt, .json, or .csv. Great for database migrations and large test fixtures.

Built-in validation

Paste any string to verify if it is a valid UUID and identify which version it is. Useful when debugging API responses or log entries.

How to use the UUID Generator

  1. 1

    Choose UUID version

    Select v4 for general use (99% of cases), v7 for database primary keys that need sorting, v1 for legacy systems that require it.

  2. 2

    Choose quantity

    Generate a single UUID or up to 1,000 at once for bulk scenarios like test data seeding or batch provisioning.

  3. 3

    Pick output format

    Standard lowercase hyphenated form, uppercase, with-braces GUID (for .NET / Windows), or compact 32-char hex.

  4. 4

    Click Generate

    UUIDs appear instantly. Each run produces completely different values (v4, v7) or sequential time-ordered values (v1, v7).

  5. 5

    Copy, download, or use in code

    Copy single UUIDs with the Copy button, or download bulk output as text/JSON/CSV for database imports.

Common use cases for the UUID Generator

Database design

  • Primary keys: UUID primary keys let you generate IDs on the client or in serverless functions, then insert them into the database without round-tripping to fetch an auto-increment ID.
  • Distributed systems: In microservices, each service can generate its own UUIDs without coordination. No central ID service needed.
  • Database merging: When consolidating data from multiple databases, UUIDs guarantee no primary key collisions.
  • Sharded databases: Sharding by UUID prefix works cleanly — no hot shards like you get with sequential IDs.

APIs and services

  • Correlation IDs for tracing: Attach a UUID to every incoming request. Include it in logs across all services for distributed tracing (OpenTelemetry, Datadog, Honeycomb).
  • Idempotency keys: Clients send a UUID with mutating API calls. Server deduplicates by UUID, preventing duplicate charges or actions on retry.
  • Session and token IDs: Use UUIDs for session identifiers, refresh tokens, or any opaque unique identifier exposed to clients.
  • Webhook and event IDs: Give every outbound webhook a UUID so consumers can deduplicate and trace events.

Testing and development

  • Test fixtures: Generate unique test user IDs, order IDs, and resource identifiers that will not collide with production data.
  • Database seeding: Bulk-generate UUIDs and insert them as part of migration scripts or seed files.
  • Load testing: Generate unique identifiers for each synthetic user or request in performance tests.

Mobile and offline apps

  • Offline-first synchronization: Mobile apps generate UUIDs locally so users can create records offline. When the app reconnects, records sync without ID conflicts.
  • Device identifiers: Use UUIDs as anonymous device or install IDs instead of MAC addresses or personal data.

UUID Generator — examples

UUID v4 (random)

The default. 122 bits of randomness.

Input
Click Generate
Output
550e8400-e29b-41d4-a716-446655440000

UUID v7 (sortable)

Timestamp prefix makes it sortable by creation time. Generated 2 seconds apart, in order.

Input
Generate 2 UUIDs v7
Output
018fc4b3-4a8f-7123-a9c7-41d265e0e54c
018fc4b3-4ab2-7e4a-8a34-c2b0a7e61fb0

Bulk generate 5 v4 UUIDs

Common for test fixtures and database seeding.

Input
Quantity: 5, version: 4
Output
4f2a1b78-6c5e-4fd1-9b23-88e3a4c9f21d
7d9e3a6f-2b45-48c1-b8d6-5c91f3a2b7e8
1c8a6d4f-9e73-42b5-a8fc-2e5d9b07c3a1
3b7f9e2d-8c14-4f6a-91b8-6d3e0a5c8f74
9a4e6d2f-5b83-41c7-bd54-7c2a9f3b6e18

SQL INSERT with UUIDs

Ready-to-paste SQL for seeding a database.

Input
Output format: SQL
Output
INSERT INTO users (id, name) VALUES
('4f2a1b78-6c5e-4fd1-9b23-88e3a4c9f21d', 'Alice'),
('7d9e3a6f-2b45-48c1-b8d6-5c91f3a2b7e8', 'Bob'),
('1c8a6d4f-9e73-42b5-a8fc-2e5d9b07c3a1', 'Carol');

Microsoft GUID (with braces)

Windows/.NET GUID format wraps in braces.

Input
Format: braces
Output
{550e8400-e29b-41d4-a716-446655440000}

Compact (no hyphens)

32-character hex string without separators, used in some APIs and URLs.

Input
Format: no hyphens
Output
550e8400e29b41d4a716446655440000

Technical details

UUIDs were originally standardized in RFC 4122 (2005) and updated in RFC 9562 (2024), which added modern versions like UUID v6, v7, and v8. A UUID is a 128-bit number (16 bytes) displayed as 32 hexadecimal characters in the canonical form xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx where M indicates the version (1-8) and the first hex digit of N indicates the variant.

UUID v4 (random): The most widely used version. 122 bits of the 128 are random, providing ~2^122 possible values (5.3 × 10^36). The probability of collision is negligible — generating 1 billion v4 UUIDs per second for 85 years gives only a 50% chance of any single collision. Use v4 as your default for primary keys, session IDs, and any case where you don't need sorting.

UUID v1 (timestamp + MAC): Includes a 60-bit timestamp and the MAC address of the generating host. Sequential and somewhat predictable. Leaks the MAC address of your server, which is a minor privacy concern. Rarely used today — most systems should use v4 or v7 instead.

UUID v7 (Unix timestamp + random): The new recommended UUID for databases. First 48 bits are a Unix timestamp (milliseconds since 1970), followed by random bits. UUIDs are naturally sortable by creation time — perfect for database indexes (avoiding the B-tree fragmentation that v4 causes), log entries, and event streams. Standardized in RFC 9562 (2024). Replaces ad-hoc formats like ULID and KSUID.

UUID v3 and v5 (namespace-based): Deterministic UUIDs derived from a namespace UUID and a name (string). v3 uses MD5, v5 uses SHA-1. Same input always produces the same UUID — useful when you need reproducible IDs for the same source (e.g., deriving a UUID from a URL).

Canonical format:

``
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
4 bits = M = version (1, 4, 7, etc.)
first hex digit of N = variant (typically 8, 9, a, or b for RFC 4122 variant)
``

Validation regex (any version):

``
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
``

UUIDs are case-insensitive in theory, but RFC 4122 Section 3 requires generators to output lowercase and consumers to accept both cases.

Common problems and solutions

Using UUID v4 for time-ordered data in a database

Random UUID v4 primary keys destroy B-tree index locality, causing fragmentation and poor INSERT performance at scale. For high-throughput tables, use UUID v7 (sortable) or a sequential integer, with a separate UUID for external API use.

Treating UUID as a secret or secure token

UUID v4 is random but not cryptographically secret — it is meant to be unique, not unguessable. Do not use UUIDs as session tokens or password reset links without additional security. Use a CSPRNG-generated secure token (e.g., 32 bytes from crypto.getRandomValues) for that.

Storing UUIDs as VARCHAR(36) in SQL

A UUID is 16 bytes of binary data — use the native UUID type in PostgreSQL (`UUID`), MySQL 8+ (`BINARY(16)` or `UUID()` function), or SQL Server (`UNIQUEIDENTIFIER`). This saves storage and doubles index performance compared to VARCHAR(36).

Generating UUIDs with Math.random()

Math.random() is not a CSPRNG — its output has observable patterns. Use `crypto.randomUUID()` (modern browsers, Node.js 16+) or Web Crypto API with `getRandomValues()` to construct the UUID properly.

Leaking MAC address with UUID v1

UUID v1 embeds the MAC address of the generating machine, which can identify your server. For public-facing UUIDs, use v4 or v7 instead of v1.

Comparing UUIDs as strings case-sensitively

UUIDs are case-insensitive in the RFC. Always compare in lowercase (or uppercase) after normalization to avoid `550E8400...` not matching `550e8400...` for the same UUID.

Assuming UUID uniqueness across all versions

Collisions between v4 UUIDs are astronomically unlikely. But NIL UUID (`00000000-0000-0000-0000-000000000000`) and max UUID (`ffffffff-...`) are valid values used as sentinels — your code may need to handle these specially.

Exposing sequential v7 UUIDs in public URLs

UUID v7 UUIDs reveal when each was created. This can leak timing information (user signup patterns, order volumes). For public-facing IDs, use v4; reserve v7 for internal database keys.

UUID Generator — comparisons and alternatives

UUID v4 vs v7: v4 is 100% random — great for uniqueness, bad for database indexes at scale. v7 includes a millisecond timestamp prefix — sortable, massively better INSERT performance, recommended for new systems (RFC 9562, 2024). If your database supports UUID v7, use it as the default for primary keys.

UUID vs ULID: ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier with a millisecond timestamp prefix, encoded in Crockford Base32 (26 characters, no hyphens). It predates UUID v7 and solves the same problem. UUID v7 is now the standards-blessed successor — use v7 in new projects instead of ULID.

UUID vs KSUID: KSUID (K-Sortable Unique Identifier) is a 160-bit identifier with a second-precision timestamp prefix. Similar goal to ULID and UUID v7. Use UUID v7 unless you need second-granularity for some reason.

UUID vs auto-increment integers: Integer primary keys are smaller (4-8 bytes vs 16), faster to index and join, and easier to read. But they require a central ID source (the database), leak row count, and cause ID collisions when merging databases. UUIDs are better for distributed systems; integers are better for single-DB applications with no merging or offline-first requirements.

UUID vs Snowflake ID: Snowflake IDs (invented by Twitter, used by Discord, etc.) are 64-bit IDs with a timestamp + worker ID + sequence structure. Smaller than UUID (64 vs 128 bits) and sortable. But they require coordinating worker IDs across your infrastructure. UUID v7 gives similar benefits without the coordination.

UUID vs nanoid: Nanoid is a 21-character random identifier (128 bits of entropy like UUID v4) using a URL-safe alphabet. Slightly shorter in string form. Popular in JavaScript ecosystems. Not a replacement for UUID in database contexts but good for URL-safe public IDs.

Frequently asked questions about the UUID Generator

What is a UUID?

A UUID (Universally Unique Identifier), also called a GUID (Globally Unique Identifier), is a 128-bit number used to identify information in computer systems. UUIDs look like 550e8400-e29b-41d4-a716-446655440000 — 32 hexadecimal digits in 5 hyphen-separated groups. They are designed to be globally unique without central coordination, which makes them perfect for distributed systems, database primary keys, and anywhere you need a unique identifier.

Which UUID version should I use?

Use UUID v4 for 99% of cases — random, simple, well-supported everywhere. Use UUID v7 for database primary keys if your database supports it (PostgreSQL 18+, MySQL 8.4+, modern libraries in every language) — the timestamp prefix gives you sortable IDs without the index fragmentation of v4. Avoid v1 (leaks MAC address) unless you have a legacy reason. Use v3/v5 (namespace-based) only when you need deterministic IDs derived from input.

Can UUIDs collide?

For UUID v4: the probability is negligible. Generating 1 billion v4 UUIDs per second for 85 years gives you a 50% chance of any single collision — not realistic in any real system. For UUID v1 and v7, the timestamp prevents collisions on the same machine. In practice, you will never see a collision with properly generated UUIDs.

Are UUIDs case-sensitive?

No. UUIDs use hexadecimal (0-9, a-f) which has no case distinction. RFC 4122 requires generators to output lowercase and consumers to accept both cases. When storing UUIDs in strings, normalize to lowercase for consistent comparison.

Should I use UUID or auto-increment integer for database IDs?

UUID if: your system is distributed, you need offline ID generation (mobile apps), you merge databases, or you want to hide row counts. Integer if: single-database system, no external exposure, and you want smallest possible indexes. For modern web apps with microservices, UUID v7 is typically the right choice — use it as the primary key.

Is the UUID generated by this tool cryptographically secure?

Yes. UUIDs v4 and v7 are generated using the Web Crypto API (crypto.getRandomValues()), which is a CSPRNG (cryptographically secure pseudo-random number generator). The same source used by TLS and modern browser cryptography. UUIDs v1 use the current timestamp plus random bytes (no real MAC address is leaked since browsers do not have access to MAC addresses).

How do I validate a UUID string?

Use this regex: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$. To also validate the version, check that the 13th character (first char of the third group) is 1, 3, 4, 5, 6, 7, or 8. The 17th character (first of the fourth group) should be 8, 9, a, or b for RFC 4122 variant UUIDs.

Can I use UUIDs in URLs?

Yes. UUIDs contain only hexadecimal characters and hyphens, all URL-safe. Some systems use the compact 32-character hex form (no hyphens) for URLs to save 4 characters. For shorter URL-friendly IDs, consider nanoid or Base62-encoded UUIDs.

What is the NIL UUID?

The NIL UUID is 00000000-0000-0000-0000-000000000000 — a valid UUID where every bit is zero. Used as a sentinel value meaning "no UUID" or "unknown", similar to using 0 for an integer ID. The max UUID ffffffff-ffff-ffff-ffff-ffffffffffff is similarly reserved.

What is the difference between UUID and GUID?

Nothing in practice — they are the same thing with different names. UUID is the IETF/RFC term (Universally Unique Identifier). GUID is the Microsoft term (Globally Unique Identifier), used in .NET, Windows, SQL Server, and COM. Microsoft GUIDs follow the same RFC 4122 format and are interoperable with UUIDs from any other system.

Additional resources

Advertisement

Related tools

All Generators

Learn more

Explore more tools

200+ free tools that run in your browser.

Browse all tools →