GeneratePass
UNIQUE IDENTIFIER GENERATOR

UUID Tools

Generate UUID v4, UUID v7, ULID, and NanoID identifiers.

About UUIDs

Identifier formats

UUID v4: Random 128-bit identifier. UUID v7: Time-ordered, includes timestamp. ULID: Universally Unique Lexicographically Sortable. NanoID: Compact URL-friendly ID.

Introduction

You've got a UUID — but what version is it? Is it valid? Can you convert it from string to bytes and back? UUID Tools is the Swiss Army knife for working with UUIDs. It parses any UUID string, validates it against RFC 4122, detects the version and variant, extracts the embedded timestamp (for v1 and v7), and converts between string, binary, and URN formats. Whether you're debugging a database issue, parsing UUIDs from API responses, or converting between formats for a migration, this tool gives you full visibility into what a UUID actually contains.

What This Tool Does

Why It Matters

UUIDs are everywhere — database columns, API responses, log files, configuration files — but they're often treated as opaque strings. Understanding a UUID's structure reveals critical information: the version tells you how it was generated (random, timestamp, or name-based), the variant confirms RFC compliance, and v1/v7 timestamps reveal when the object was created. Invalid UUIDs silently break database inserts, API calls, and authentication flows. A validation tool catches these issues before they cascade into production errors. Format conversion between string, binary, and URN is essential for database migrations, binary protocol implementations, and compliance with systems that require specific UUID representations.

How It Works

Step-by-Step Examples

Example 1: Parse and validate a UUID from an API response
1

Paste the UUID string: f47ac10b-58cc-4372-a567-0e02b2c3d479

2

The tool validates RFC 4122 compliance — checks version nibble, variant bits, and hex format

3

Display the version (4 = random) and variant (1 = RFC 4122)

4

Confirm the UUID is valid and suitable for database insertion

ResultValid UUID v4 (random), variant: RFC 4122 (10xx), 122 bits of entropy, suitable for database primary keys
Example 2: Convert a UUID between string and binary formats
1

Paste the UUID string: 550e8400-e29b-41d4-a716-446655440000

2

Select 'String to Binary' conversion mode

3

The tool outputs the 16-byte binary representation: 85 14 e8 40 0e 29 b4 1d 4a 71 64 46 65 54 00 00

4

Use the binary format for database storage or binary protocol transmission

Result8514e8400e29b41d4a71644665544000 — 16-byte hex representation for binary storage

Code Examples

javascriptParse, validate, and extract UUID metadata
function parseUUID(uuidString) {
  // Remove URN prefix if present
  const clean = uuidString.replace(/^urn:uuid:/i, '').toLowerCase();

  // Validate format: 8-4-4-4-12 hex chars
  const match = clean.match(
    /^[0-9a-f]{8}-[0-9a-f]{4}-([0-9a-f]{4})-([0-9a-f]{4})-[0-9a-f]{12}$/
  );
  if (!match) throw new Error('Invalid UUID format');

  // Extract version (byte 6 high nibble)
  const versionHex = match[1][0];
  const version = parseInt(versionHex, 16);

  // Extract variant (byte 8 high bits)
  const variantHex = match[2][0];
  const variantBits = parseInt(variantHex, 16);
  let variant;
  if (variantBits >= 8 && variantBits <= 11) variant = 'RFC 4122';
  else if (variantBits >= 12 && variantBits <= 13) variant = 'Microsoft';
  else if (variantBits === 14) variant = 'Reserved';
  else variant = 'NCS';

  // Extract timestamp for v1 and v7
  let timestamp = null;
  if (version === 1) {
    const timeLow = parseInt(clean.slice(0, 8), 16);
    const timeMid = parseInt(clean.slice(9, 13), 16);
    const timeHi = parseInt(clean.slice(14, 18), 16) & 0x0fff;
    const time = (timeHi * 2**48) + (timeMid * 2**32) + timeLow;
    timestamp = new Date((time - 122192928000000000) / 10000);
  } else if (version === 7) {
    const timeHex = clean.slice(0, 12).replace(/-/g, '');
    const timeMs = parseInt(timeHex, 16);
    timestamp = new Date(timeMs);
  }

  return {
    uuid: uuidString,
    valid: true,
    version,
    variant,
    timestamp: timestamp ? timestamp.toISOString() : null,
    bytes: clean.replace(/-/g, '')
  };
}

// Usage
console.log(parseUUID('f47ac10b-58cc-4372-a567-0e02b2c3d479'));
// { version: 4, variant: 'RFC 4122', timestamp: null, ... }
javascriptConvert UUID between string, binary, and URN formats
function uuidToBinary(uuidString) {
  const hex = uuidString.replace(/-/g, '');
  return hex.match(/.{2}/g).map(b => parseInt(b, 16));
}

function binaryToUUID(bytes) {
  const hex = bytes.map(b => b.toString(16).padStart(2, '0')).join('');
  return [
    hex.slice(0, 8),
    hex.slice(8, 12),
    hex.slice(12, 16),
    hex.slice(16, 20),
    hex.slice(20)
  ].join('-');
}

function uuidToURN(uuidString) {
  return `urn:uuid:${uuidString.toLowerCase()}`;
}

// Usage
const uuid = '550e8400-e29b-41d4-a716-446655440000';
const binary = uuidToBinary(uuid);
const backToUUID = binaryToUUID(binary);
const urn = uuidToURN(uuid);

console.log(binary);  // [85, 14, 232, 64, ...]
console.log(backToUUID); // 550e8400-e29b-41d4-a716-446655440000
console.log(urn); // urn:uuid:550e8400-e29b-41d4-a716-446655440000

UUID Version Detection

Version Nibble (byte 6, high)VersionGeneration MethodContains Timestamp?
0001v1Timestamp + MAC addressYes (60-bit, 100ns intervals)
0011v3MD5(namespace + name)No
0100v4Random (CSPRNG)No
0101v5SHA-1(namespace + name)No
0110v6Reordered timestampYes
0111v7Unix epoch + randomYes (48-bit milliseconds)
1000v8Custom/vendor-specificVaries

UUID Format Conversions

Input FormatOutput FormatExampleUse Case
StringBinary (16 bytes)f47ac10b-58cc-... → 8514e840...Database storage, binary protocols
BinaryString8514e840... → f47ac10b-58cc-...Display, API responses, logs
StringURNf47ac10b-... → urn:uuid:f47ac10b-...XML, RDF, namespace compliance
URNStringurn:uuid:f47ac10b-... → f47ac10b-...Parsing, validation
StringNo-dashf47ac10b-58cc-... → f47ac10b58cc...Compact storage, case-insensitive systems

Benefits

  • Detects UUID version (v1-v8) and variant (RFC 4122, Microsoft, Reserved) for full structural analysis.
  • Extracts embedded timestamps from v1 and v7 UUIDs, revealing creation time without external metadata.
  • Validates RFC 4122 compliance — catches malformed UUIDs before they break database inserts or API calls.
  • Converts between string, binary (16-byte), URN, and no-dash formats for database migrations and protocol implementations.

Use Cases

01

Debugging database issues where malformed UUIDs cause silent insert failures or constraint violations.

02

Parsing UUIDs from third-party API responses to extract version, timestamp, and validity metadata.

03

Converting UUID representations during database migrations between systems that require different formats.

04

Auditing UUID generation in production systems to verify the correct version and variant are being used.

Common Mistakes to Avoid

Treating all UUIDs as v4 random — v1 and v7 UUIDs contain timestamps that leak creation time.

Ignoring the variant field — Microsoft-variant UUIDs (110x) are not RFC 4122 compliant and may break standard libraries.

Converting UUIDs to lowercase without preserving case sensitivity — some systems treat UUIDs as case-sensitive strings.

Assuming v1 UUIDs are random — they embed the MAC address, which is a hardware identifier visible in public logs.

Security Implications

UUID parsing tools reveal information that UUIDs themselves are designed to convey. v1 UUIDs expose the generating machine's MAC address, enabling hardware fingerprinting. v7 UUIDs expose creation timestamps, enabling timing analysis. Even v4 UUIDs, while random, leak version information through their structure. Treat UUID parsing as a security-sensitive operation — the metadata it extracts may be more sensitive than the UUID itself. Never expose parsed v1 UUIDs in public APIs or logs without redacting the node (MAC address) field.

Security Information

Frequently Asked Questions

Fundamentals

What are UUID Tools?

UUID Tools is a comprehensive identifier generation suite that supports multiple unique identifier formats: UUID v4, UUID v7, ULID, and NanoID. Each format has distinct characteristics and use cases. UUID v4 provides purely random identifiers, UUID v7 adds time-sortability, ULIDs combine timestamps with randomness in a compact format, and NanoIDs offer URL-friendly compactness with customizable length.

Having multiple identifier formats in one tool allows you to choose the best option for your specific use case. Whether you need broad compatibility (UUID), time-based ordering (UUID v7, ULID), or compactness (NanoID), this tool has you covered with batch generation support for high-volume needs.

Technical Deep Dive

Understanding Identifier Formats

UUID v4: 128-bit random identifier (36 characters with hyphens). Provides 122 bits of randomness. Widely supported across all platforms and databases. Best for general-purpose unique identification.

UUID v7: 128-bit identifier combining a 48-bit millisecond timestamp with 74 bits of randomness. Time-sortable like ULIDs but maintains UUID format compatibility. Best for database primary keys where insertion order matters.

ULID: 128-bit identifier (26 characters) using Crockford's Base32 encoding. Combines 48-bit timestamp with 80 bits of randomness. More compact than UUIDs and URL-safe without encoding. Best for URL-safe identifiers that need time-based sorting.

NanoID: Variable-length identifier (default 21 characters) using customizable alphabet. More compact than UUIDs with equivalent collision resistance. Best for URLs, component keys, and applications where compactness matters.

Practical Applications

Choosing the Right Identifier

Database Primary Keys: Use UUID v7 or ULID for new databases that benefit from time-sortable keys. Use UUID v4 for maximum compatibility with existing systems.

API Resource Identifiers: UUID v4 provides broad compatibility. ULID or NanoID offer more compact URLs for RESTful API endpoints.

Component Keys: NanoID's compact size and URL safety make it ideal for React/Vue component keys and frontend identifiers.

Log Aggregation: UUID v7 or ULID ensure events are processed in chronological order when combining logs from multiple sources.

Security Pitfalls

Identifier Generation Mistakes

Using Wrong Format for Use Case: UUIDs embed timestamps (v1) or are too long for URLs. ULIDs leak creation time. NanoIDs lack standardization. Choose the format based on your specific requirements.

Not Using Cryptographic Randomness: All identifier formats must use crypto.getRandomValues() for security applications. Using Math.random() produces predictable identifiers.

Ignoring Compatibility: Not all databases and systems support all identifier formats. UUID v4 has the broadest support. Test your chosen format in your target environment before deploying.

Using Identifiers as Secrets: All these formats are public identifiers, not secrets. Never use them as API keys, passwords, or authentication tokens.

Related Tools

Related Generation Tools

Explore these related generation tools:

Frequently Asked Questions

Which identifier format should I choose?
For maximum compatibility, use UUID v4. For time-sortable database keys, use UUID v7. For compact URL-safe identifiers, use ULID. For shortest possible IDs, use NanoID. Consider your specific requirements for compatibility, sortability, and compactness.
Can I batch generate identifiers?
Yes. Our tool supports batch generation for all formats. This is useful for database seeding, test data generation, and high-volume applications. Batch generation maintains the same security guarantees as single generation.
Are these identifiers secure?
All formats use cryptographic randomness via crypto.getRandomValues(), making them unpredictable. However, they are public identifiers, not secrets. Do not use them as passwords, API keys, or authentication tokens.
What is the difference between UUID v4 and v7?
UUID v4 is purely random. UUID v7 combines a millisecond timestamp with randomness, making it time-sortable. UUID v7 is newer and recommended for database primary keys where chronological ordering improves query performance.
Can I use these identifiers in URLs?
UUIDs contain hyphens, which are URL-safe. ULIDs use Crockford's Base32 (URL-safe). NanoIDs are designed for URL safety. All formats work in URLs without encoding. Choose based on your compactness and compatibility requirements.