UUID v4 Generator

Generate cryptographically random UUID v4 identifiers. Bulk generate up to 100 at once, choose uppercase or lowercase, and toggle hyphens. All generation happens locally — nothing is sent to any server.

1100
Format
Hyphens
0 UUIDs generated

    Why use our online UUID v4 Generator?

    Generate RFC 4122-compliant UUID v4 (random) and v1 (time-based) identifiers instantly in your browser using the Web Crypto API. Copy single UUIDs or bulk-generate a list.

    How to use UUID v4 Generator

    1. 1
      Choose how many UUIDs to generate

      Use the count slider to select anywhere from 1 to 100 UUIDs. The default is 1 for a single identifier.

    2. 2
      Select formatting options

      Toggle between uppercase and lowercase output. Optionally remove hyphens to get a compact 32-character string.

    3. 3
      Click Generate

      Press the Generate button to create cryptographically random UUID v4 values using your browser's built-in crypto API.

    4. 4
      Copy individual UUIDs

      Click the copy icon next to any UUID to copy just that one value to your clipboard.

    5. 5
      Copy all at once

      Use the Copy All button to copy every generated UUID to your clipboard, one per line — ready to paste into code or a spreadsheet.

    UUID versions — v1 through v7 explained

    UUID has seven versions defined across two RFCs, each using a different strategy for generating unique identifiers.

    Version 1 (time-based): embeds the current timestamp and the MAC address of the generating machine. It guarantees uniqueness across machines and time, but exposes the generating machine's MAC address — a privacy concern. The timestamp component also makes sequential UUIDs, which can be advantageous for database index performance.

    Version 3 and 5 (name-based): generate UUIDs deterministically from a namespace and a name (any string). Version 3 uses MD5 hashing; Version 5 uses SHA-1. The same namespace + name always produces the same UUID — useful for content-addressable identifiers.

    Version 4 (random): 122 bits of cryptographic randomness with 6 bits reserved for version and variant markers. This is the most widely used UUID format — generated by this tool. The collision probability is astronomically low (roughly 1 in 5.3 × 10³⁶ for any two UUIDs).

    Version 6 and Version 7 (newer standards, RFC 9562, 2024): Version 7 is time-ordered with millisecond precision and 74 bits of randomness. Unlike v1, it uses a simple Unix timestamp (not Gregorian time) and is monotonically increasing within the same millisecond. UUID v7 is becoming the preferred choice for database primary keys because sequential insertion avoids B-tree fragmentation.

    UUID vs ULID vs NanoID — choosing a unique identifier format

    UUID v4 is not the only option for distributed unique identifiers. Several alternatives have emerged to address specific limitations.

    ULID (Universally Unique Lexicographically Sortable Identifier) encodes a 48-bit Unix timestamp followed by 80 bits of randomness, formatted as a 26-character base32 string (e.g., 01ARZ3NDEKTSV4RRFFQ69G5FAV). ULIDs are sortable — lexicographic order matches chronological creation order — which makes them useful for database pagination and time-series data. They are also URL-safe and case-insensitive.

    NanoID is a smaller, faster, URL-friendly random ID generator. By default it generates 21-character IDs using a 64-character alphabet (A-Za-z0-9_-), which provides approximately 126 bits of randomness — comparable to UUID v4. The smaller size (21 vs 36 characters) reduces storage and URL length. It is popular in web applications where compactness matters.

    For most applications, the choice comes down to: use UUID v4 (or v7) when interoperating with systems that expect RFC 4122 UUID format. Use ULID when time-sortability matters (event streams, audit logs, database primary keys with chronological access patterns). Use NanoID when compactness and URL-safety are priorities (short IDs in URLs, session tokens, reference codes).

    UUID as a database primary key — the trade-offs

    Using UUID v4 as a primary key in a relational database (PostgreSQL, MySQL) offers several benefits but also creates a significant performance problem at scale.

    Benefits: UUIDs can be generated by the application layer without a database round-trip, enabling batch inserts without coordination. Multiple services can independently create records without risk of ID collision. UUIDs are opaque — they don't expose insertion order or row count to clients, unlike sequential integers.

    The performance problem: UUID v4 values are random, so new records insert at random positions in the primary key B-tree index. This causes frequent page splits, poor cache utilization (index pages scattered across storage), and increased I/O. At hundreds of millions of rows, the performance penalty compared to sequential integers (BIGINT AUTO_INCREMENT) becomes significant.

    Solutions: UUID v7 addresses this by making UUIDs time-sorted — new records always insert near the end of the index. PostgreSQL's native UUID type stores UUIDs as 16-byte binary (more efficient than the 36-character string). For PostgreSQL, consider storing UUIDs as bytes rather than text. Alternatively, use a BIGINT primary key internally and expose UUID (derived from a separate UUID column) in the public API.

    Frequently Asked Questions

    What is a UUID?

    UUID (Universally Unique Identifier) is a 128-bit identifier standardised by RFC 4122. UUID v4 is randomly generated, producing values like '550e8400-e29b-41d4-a716-446655440000'. The probability of two random v4 UUIDs colliding is astronomically small — roughly 1 in 5.3 × 10³⁶.

    Are these UUIDs truly random?

    Yes. This tool uses the browser's built-in crypto.randomUUID() API, which draws from the same cryptographically secure random number generator used for TLS and other security functions. It is safe to use these UUIDs as database primary keys or session tokens.

    Is my UUID generation private?

    Completely. All UUIDs are generated locally in your browser. Nothing is sent to any server. You can use this tool completely offline once the page has loaded.

    What is the difference between UUID v4 with and without hyphens?

    A standard UUID v4 is 36 characters with hyphens (e.g., 550e8400-e29b-41d4-a716-446655440000). Removing hyphens gives a compact 32-character hex string (e.g., 550e8400e29b41d4a716446655440000). Both represent exactly the same value — the choice depends on your system's storage format.

    Can I use UUID v4 as a database primary key?

    Yes. UUID v4 is widely used as a distributed, collision-resistant primary key — especially in microservices where multiple services create records without a central auto-increment sequence. For write-heavy databases, consider UUID v7 (time-ordered) to avoid index fragmentation, though v4 remains the most common choice.

    What is the format of a UUID v4?

    A UUID v4 follows the pattern xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, where 4 indicates version 4 and y is one of 8, 9, a, or b (indicating RFC 4122 variant). The remaining 122 bits are random.

    Related Tools