toolqik

04 · Generators

UUID Generator

UUID v4, time-ordered v7 and v1, in bulk, plus a UUID inspector.

Runs in your browser
Version
Format
UUIDs

    Inspect a UUID

    About this tool

    A UUID (Universally Unique Identifier) is a 128-bit ID that you can create anywhere, without asking a central database for the next number, and still be practically certain no one else will ever create the same one. It’s written as 32 hexadecimal digits in five groups, 8-4-4-4-12, like 0193a5e2-7c41-7b1e-9f2a-4d8c51e0b7a3. UUIDs are used as database keys, request and trace IDs, file names, idempotency keys and message IDs.

    How to use this UUID generator

    1. Choose v4 (random) or v7 (time-ordered).
    2. Set how many you need, up to 100 at a time, and pick a format: uppercase, with or without hyphens, or wrapped in {braces} like a Windows GUID.
    3. Copy the whole list or download it as a text file. Press G to generate a fresh batch.
    4. To check an existing ID, paste it into Inspect a UUID. It shows the version, the variant and, for v7 and v1, the date and time it was created.

    Every UUID is generated in your browser with the Web Crypto API’s secure random generator. Nothing is sent to a server, and a batch of v7 IDs is strictly increasing, even within the same millisecond.

    UUID v4 vs. UUID v7

    UUID v4UUID v7
    Made from122 random bits48-bit Unix timestamp (ms) + 74 random bits
    Sort orderRandomCreation order
    Database indexInserts land all over the index, causing page splits and a larger indexInserts go to the end, like an auto-increment key
    Reveals creation timeNoYes, to the millisecond
    Best forPublic tokens, IDs that must not leak timingPrimary keys, event and log IDs, anything sorted by time

    Both versions are defined in RFC 9562 (2024), which replaced RFC 4122. A rule of thumb: use v7 for database primary keys and v4 when the ID is shown to users and shouldn’t reveal when something was created.

    Anatomy of a UUID

    Two positions tell you what kind of UUID you have. In 0193a5e2-7c41-7b1e-9f2a-4d8c51e0b7a3:

    • The first digit of the third group is the version: 4 for random, 7 for time-ordered, 1 for the old MAC-address-and-time format.
    • The first digit of the fourth group is the variant. For standard UUIDs it’s 8, 9, a or b.
    • In a v7 UUID, the first 12 hex digits are the creation time in milliseconds since 1970. Paste one into the inspector to see it as a date.

    All UUID versions

    VersionBased onUse today?
    v1Timestamp + MAC addressLegacy systems. Classic v1 leaks the machine’s MAC address; this tool uses a random node ID instead
    v3MD5 hash of a namespace and namePrefer v5
    v4RandomYes, the general-purpose default
    v5SHA-1 hash of a namespace and nameYes, when the same input must always give the same UUID
    v6v1 reordered to sort by timeOnly for compatibility with v1 systems
    v7Unix timestamp (ms) + randomYes, for sortable IDs and database keys
    v8Custom, vendor-defined layoutSpecial cases only

    There are also two special values: the nil UUID (all zeros) and the max UUID (all fs), often used as placeholders.

    Generate UUIDs in code

    // v4: built into browsers and Node.js 19+ (or require('node:crypto') in 14.17+)
    const id = crypto.randomUUID();
    
    // v7: npm install uuid
    import { v7 as uuidv7 } from 'uuid';
    const sortableId = uuidv7();

    To check whether a string is a valid UUID, this regular expression matches versions 1 to 8 in the standard variant: ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ (case-insensitive). Try it in the regex tester.

    UUIDs as database keys

    • Store them as a native type, not text: uuid in PostgreSQL, BINARY(16) in MySQL, uniqueidentifier in SQL Server. That’s 16 bytes instead of 36.
    • Prefer v7 for primary keys. Random v4 keys scatter inserts across the index, which slows large tables down.
    • UUIDs are not secrets. They’re hard to guess but not designed as access tokens. For API keys or reset links, use the API key generator or a random string instead.

    FAQ

    Should I use UUID v4 or v7?

    Use v7 for database primary keys and anything you will sort by creation time. Use v4 when the identifier must not reveal when it was created.

    Can two UUIDs collide?

    In practice, no. You would need to generate about 2.7 quintillion v4 UUIDs to have a 50% chance of a single collision.

    What is a GUID?

    GUID is Microsoft’s name for the same 128-bit format. Use the braces and uppercase options to match the common Windows notation.

    How do I generate a UUID in JavaScript?

    Call crypto.randomUUID(). It is built into modern browsers and Node.js and returns a random v4 UUID. For v7, use the uuid package from npm.

    How can I tell which version a UUID is?

    Look at the first digit of the third group: 0193a5e2-7c41-7b1e-… is version 7. Or paste it into the inspector on this page.

    Can I get the creation time from a UUID?

    Only from time-based versions. A v7 UUID stores the creation time in milliseconds in its first 48 bits, and v1 and v6 store a timestamp too. A v4 UUID contains no time information.

    Are UUIDs case-sensitive?

    No. RFC 9562 says UUIDs should be output in lowercase but compared case-insensitively, so 0193A5E2-… and 0193a5e2-… are the same UUID.

    Are these UUIDs generated on a server?

    No. They are created in your browser with the Web Crypto API, and nothing is sent anywhere.

    esc
    ↑↓ navigate↵ open