Skip to main content

    UUID Generator

    Generate random UUID v4 identifiers instantly. Cryptographically secure, browser-based, and free.

    Free to use. Runs in your browser.

    UUID v4 uses 122 random bits for virtually collision-free unique identifiers.

    What Is a UUID and When Should You Use One?

    A UUID (Universally Unique Identifier) is a 128-bit number formatted as 32 hexadecimal digits in five groups: 550e8400-e29b-41d4-a716-446655440000. The key property: any two UUIDs generated anywhere in the world at any time are virtually guaranteed to be different. No coordination needed.

    Think of it like this: the total number of possible UUIDs is 2128, roughly 340 undecillion (340 followed by 36 zeros). You could generate a billion UUIDs per second for 100 years and the probability of a collision would still be negligible. That's why databases, distributed systems, and APIs use them as primary keys.

    This generator creates v4 UUIDs (random), the most common type. Each one is generated using your browser's cryptographic random number generator, so they're suitable for production use. Generate one or many, copy, and paste into your code.

    UUID Versions Compared

    VersionBased OnWhen to Use
    v1Timestamp + MAC addressWhen you need time-ordering and traceability (leaks MAC address)
    v3MD5 hash of namespace + nameDeterministic IDs from known input (use v5 instead, MD5 is weak)
    v4Random numbersGeneral purpose, most common. This is what this tool generates
    v5SHA-1 hash of namespace + nameDeterministic IDs where same input always gives same UUID
    v7 (new)Timestamp + randomSortable by time, better database index performance than v4

    What this means for you: Use v4 for general-purpose IDs. If you need sortable, time-ordered IDs (better for database performance), consider v7 UUIDs or ULID. If you need deterministic IDs (same input → same UUID), use v5.

    UUID vs Other ID Formats

    FormatLengthSortableBest For
    UUID v436 charsNoGeneral-purpose unique IDs
    UUID v736 charsYes (by time)Database primary keys
    ULID26 charsYes (by time)Compact, sortable alternative to UUID
    NanoID21 chars (default)NoURL-safe, compact IDs
    Auto-incrementVariableYesSingle-database systems (leaks count)
    Snowflake ID18-19 digitsYes (by time)Distributed systems (Twitter, Discord)

    UUID Practical Considerations

    Database performance

    Random v4 UUIDs cause index fragmentation in B-tree databases (PostgreSQL, MySQL). v7 UUIDs or ULIDs are time-ordered, so inserts are sequential and indexes stay efficient. Use v7 for high-write databases.

    Storage format

    Store UUIDs as native UUID type (16 bytes) in PostgreSQL, not VARCHAR(36). The text format with hyphens takes 36 bytes plus overhead. Binary storage is 2x smaller and compares faster.

    Don't expose sequential IDs

    Auto-increment IDs (user/1, user/2, user/3) leak information: how many users you have, when they signed up, and make it trivial to enumerate resources. UUIDs hide this.

    UUIDs aren't secrets

    UUIDs are unguessable but not secret. Don't use a UUID as an authentication token or session key. An attacker who intercepts a UUID can reuse it. Use proper cryptographic tokens for security.

    Generating UUIDs in Code

    LanguageCode
    JavaScriptcrypto.randomUUID()
    Pythonimport uuid; str(uuid.uuid4())
    PostgreSQLgen_random_uuid()
    RubySecureRandom.uuid
    Gouuid.New() // google/uuid
    CLI (Linux/Mac)uuidgen

    JavaScript's crypto.randomUUID() is available in all modern browsers and Node.js 19+. No library needed, it's built in.

    Related Tools

    How to use this tool

    1

    Choose the number of UUIDs to generate

    2

    Click Generate to create new UUIDs instantly

    3

    Copy individual UUIDs or all at once

    Common uses

    • Generating unique database primary keys
    • Creating unique identifiers for API resources
    • Assigning session or transaction IDs
    • Producing unique file names to prevent collisions

    Share this tool

    Frequently Asked Questions

    What is a UUID?
    A UUID (Universally Unique Identifier) is a 128-bit number formatted as 32 hex digits in five groups: 550e8400-e29b-41d4-a716-446655440000. Any two UUIDs generated anywhere are virtually guaranteed to be different, no coordination needed.
    Are UUIDs truly unique?
    UUID v4 uses 122 random bits, giving about 5.3 × 10³⁶ possible values. You could generate a billion UUIDs per second for 100 years and the probability of a single collision would still be negligible.
    Is this generated server-side?
    No. UUIDs are generated entirely in your browser using crypto.randomUUID(), the Web Crypto API's built-in UUID generator. It uses cryptographically secure randomness, making these suitable for production use.
    What format options are available?
    Standard (with hyphens: 550e8400-e29b-41d4-...), no hyphens (550e8400e29b41d4...), uppercase (550E8400-E29B-...), and braces format ({550e8400-e29b-...}). The braces format is used in Windows/COM programming.
    What's the difference between UUID v4 and v7?
    v4 is purely random. v7 encodes a timestamp in the first 48 bits plus random data, making it time-sortable. v7 is better for database primary keys because sequential inserts are more efficient for B-tree indexes. This tool generates v4.
    Should I use UUIDs as database primary keys?
    v4 UUIDs work but cause index fragmentation in B-tree databases (PostgreSQL, MySQL) because random values scatter inserts. Consider v7 UUIDs or ULIDs for high-write databases, they're time-ordered, so inserts are sequential.
    How do I store UUIDs efficiently in a database?
    Use the native UUID type in PostgreSQL (16 bytes). In MySQL, use BINARY(16) with UUID_TO_BIN(). Don't store as VARCHAR(36), it wastes space (36 bytes + overhead vs 16 bytes) and compares slower.
    What's the difference between UUID and GUID?
    Nothing, they're the same thing. UUID is the IETF standard name. GUID (Globally Unique Identifier) is Microsoft's name for the same format. Both are 128-bit identifiers formatted identically.
    Can I generate UUIDs in my code?
    JavaScript: crypto.randomUUID(). Python: import uuid; uuid.uuid4(). Java: UUID.randomUUID(). Go: uuid.New() (google/uuid package). PHP: Ramsey\Uuid\Uuid::uuid4(). All produce standard v4 UUIDs.
    Are UUIDs secure enough for tokens?
    UUIDs are unguessable but not secret. They're fine for resource identifiers but shouldn't be used as authentication tokens or API keys. An attacker who intercepts a UUID can reuse it. Use proper cryptographic tokens (like those from crypto.randomBytes) for security.
    What's a ULID and how does it compare?
    A ULID (Universally Unique Lexicographically Sortable Identifier) is 26 characters (vs UUID's 36), time-sortable, and URL-safe. It's a compact, modern alternative to UUID v4. If you need sortability and compactness, ULID is worth considering.
    Can I generate UUIDs in bulk?
    Yes, set the count to up to 100 and click Generate. All UUIDs are created instantly. Copy them all at once or generate more batches as needed.

    Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.