UUID Generator

Generate standard UUIDs and GUIDs with customization options for development and testing

Generated UUIDs

    UUID Structure Visualization

    xxxxxxxx
    time-low
    xxxx
    time-mid
    xxxx
    time-high + version
    xxxx
    clock-seq + variant
    xxxxxxxxxxxx
    node
    Version: – | Variant: –

    Implementation Code Samples

    // Using the uuid package
    // Install: npm install uuid
    
    // For UUID v4 (random)
    import { v4 as uuidv4 } from 'uuid';
    const uuid = uuidv4();
    console.log(uuid); // e.g., '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
    
    // For UUID v1 (timestamp-based)
    import { v1 as uuidv1 } from 'uuid';
    const uuidTimestamp = uuidv1();
    console.log(uuidTimestamp);
    
    // For UUID v5 (namespace)
    import { v5 as uuidv5 } from 'uuid';
    // Define namespace (predefined ones from RFC)
    const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
    // Generate a UUID for a specific name in the namespace
    const uuid = uuidv5('example.com', DNS);
    console.log(uuid);
    

    About UUIDs (Universally Unique Identifiers)

    What is a UUID?

    A UUID (Universally Unique Identifier) is a 128-bit identifier that is guaranteed to be unique across space and time. UUIDs are standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE). They are commonly used as database keys, session identifiers, transaction IDs, and in any scenario where a unique identifier is needed without requiring a central authority to issue them.

    UUID Versions

    • UUID v1 (Time-based): Generated using the current timestamp and the MAC address of the computer.
    • UUID v4 (Random): Generated using random or pseudo-random numbers. Most commonly used version.
    • UUID v5 (Name-based, SHA-1): Generated by hashing a namespace identifier and name.

    UUID Format

    A standard UUID is represented as 32 hexadecimal digits, displayed in five groups separated by hyphens in the form 8-4-4-4-12 for a total of 36 characters (including hyphens). For example: 550e8400-e29b-41d4-a716-446655440000

    Common Use Cases

    • • Database primary keys
    • • Distributed systems for generating unique identifiers
    • • Session identifiers in web applications
    • • Transaction IDs in financial systems
    • • Object identifiers in content management systems
    • • File names in storage systems