UUID Generator

Generate Universally Unique Identifiers (UUIDs) in various versions for unique identification

UUID Generation Settings

Random/pseudo-random
Most common, cryptographically secure

Time-based UUIDs

Version 1: MAC + timestamp
Sortable by creation time
Globally unique
May leak MAC address
Best for: Event logs, audit trails

Random UUIDs

Version 4: Cryptographically random
No information leakage
Most widely supported
Excellent uniqueness
Best for: General purpose, API keys

Hash-based UUIDs

Version 5: SHA-1 deterministic
Deterministic generation
Reproducible results
No random dependency
Best for: Content addressing

UUID Best Practices

  • Default Choice: Use UUID v4 for most applications - it's secure and widely supported
  • Database Keys: Consider using sequential UUIDs (v1) for better index performance
  • Deterministic IDs: Use v5 when you need consistent UUIDs from the same input
  • Storage: Store as binary (16 bytes) rather than string (36 chars) when possible
  • Validation: Always validate UUID format when receiving from external sources

About UUID (Universally Unique Identifier)

UUID (Universally Unique Identifier) is a 128-bit standardized identifier format defined by RFC 4122. UUIDs are designed to be unique across space and time without requiring a central authority, making them perfect for distributed systems, databases, and applications requiring unique identification.

  • 128-bit (16-byte) standardized format with global uniqueness
  • Multiple versions (v1, v4, v5) for different use cases and requirements
  • Widely supported across programming languages and databases
  • RFC 4122 compliance ensuring interoperability and standards
  • No central authority needed for generation and collision avoidance

UUID Versions and Types

Time-Based UUIDs

  • Version 1: MAC address + timestamp based
  • Version 6: Reordered v1 for better sorting
  • Version 7: Unix timestamp + random data
  • Pros: Sortable, contains creation time
  • Cons: May leak MAC address or time info
  • Use cases: Audit trails, event sourcing

Random & Hash-Based UUIDs

  • Version 4: Purely random/pseudo-random
  • Version 3: MD5 hash-based (deprecated)
  • Version 5: SHA-1 hash-based
  • Pros: No information leakage, very secure
  • Cons: No inherent ordering or time info
  • Use cases: General purpose, API keys

Frequently Asked Questions

How to generate UUID?

Select a UUID version (v4 for random, v7 for time-sorted) on the utilAZ generator, choose how many you need, and click Generate. The tool uses the Web Crypto API client-side so no data is sent to any server. Copy the results in standard, no-dash, or braced format.

What is UUID used for?

UUIDs are used as database primary keys, session identifiers, API request IDs, distributed system coordination tokens, file naming, message queue deduplication keys, and anywhere a globally unique identifier is needed without a central authority.

Difference between UUID v4 and v7?

UUID v4 is fully random (122 random bits) with no inherent ordering. UUID v7 (RFC 9562) embeds a Unix millisecond timestamp in the first 48 bits followed by random data, making it naturally sortable by creation time -- ideal for database indexes and B-trees.

How to generate UUID in JavaScript?

In modern browsers and Node 19+, use crypto.randomUUID() for a v4 UUID. For older environments use the uuid npm package: import { v4 as uuidv4 } from 'uuid'; const id = uuidv4(). Both produce standard 8-4-4-4-12 format strings.

UUID vs GUID what's the difference?

They are the same thing. GUID (Globally Unique Identifier) is Microsoft's term for UUID (Universally Unique Identifier). Both follow RFC 4122/9562, are 128 bits, and use the same 8-4-4-4-12 hex format. Microsoft tools may display GUIDs with braces: {xxxxxxxx-xxxx-...}.

UUID Structure and Format

Standard Format:

String Format (36 chars)
XXXXXXXX-XXXX-MXXX-NXXX-XXXXXXXXXXXX
8-4-4-4-12 hexadecimal digits
Version & Variant Bits
• M = Version (1, 3, 4, 5, 6, 7)
• N = Variant (first hex digit: 8, 9, A, B)
• Total: 128 bits (16 bytes)

Example UUIDs:

Version 1 (Time-based):
6ba7b810-9dad-11d1-80b4-00c04fd430c8
Version 4 (Random):
f47ac10b-58cc-4372-a567-0e02b2c3d479
Version 5 (SHA-1):
74738ff5-5367-5958-9aee-98fffdcd1876

UUID Generation Implementation

Practical UUID generation examples using native APIs and popular libraries:

JavaScript — Native API:

// UUID v4 (random) — built-in const uuid = crypto.randomUUID(); // → "f47ac10b-58cc-4372-a567-0e02b2c3d479" // Manual UUID v4 (fallback) function uuidV4() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' .replace(/[xy]/g, c => { const r = crypto.getRandomValues(new Uint8Array(1))[0] & 15; return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); }); } // Validate UUID format const isValid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(uuid);

Python — uuid module:

import uuid # UUID v4 (random) id_v4 = uuid.uuid4() # → UUID('f47ac10b-58cc-4372-a567-0e02b2c3d479') # UUID v1 (time-based) id_v1 = uuid.uuid1() # UUID v5 (SHA-1 namespace) id_v5 = uuid.uuid5(uuid.NAMESPACE_DNS, 'example.com') # Parse and validate parsed = uuid.UUID('f47ac10b-58cc-4372-a567-0e02b2c3d479') print(parsed.version) # 4

Node.js — crypto module:

const crypto = require('crypto'); // UUID v4 (random) — built-in since Node 14.17 const uuid = crypto.randomUUID(); // Generate multiple UUIDs const uuids = Array.from({ length: 5 }, () => crypto.randomUUID()); console.log(uuids); // Array of 5 unique UUIDs

UUID Standards and Compatibility

Standards Compliance:

RFC 4122: Primary UUID specification
ISO/IEC 9834-8: International standard
ITU-T X.667: Telecommunications standard
IETF Draft: New UUID versions (6, 7, 8)
Database Support: PostgreSQL, MySQL, etc.

Language Support:

JavaScript: Native crypto.randomUUID() (v4)
Python: uuid module with all versions
Java: java.util.UUID class
C#: System.Guid structure
Go: google/uuid package
PHP: Built-in uniqid() and libraries

UUID Best Practices

  • Version Selection: Use v4 for general purposes, v1 for time-based sorting, v5 for deterministic generation
  • Storage Optimization: Store as binary (16 bytes) rather than strings (36 chars) when possible
  • Database Indexing: Consider using sequential UUIDs (v1, v6, v7) for better B-tree index performance
  • Security Considerations: Be aware that v1 UUIDs may leak MAC addresses and timestamps
  • Case Sensitivity: Standardize on lowercase representation for consistency
  • Validation: Always validate UUID format and version when parsing from external sources

Common Use Cases

  • Database primary keys and foreign keys
  • Session identifiers and tokens
  • File and document unique naming
  • Distributed system coordination
  • API resource identifiers
  • Transaction and correlation IDs
  • Message queue identifiers
  • Cache keys and object identification