UUID Tools
Generate UUID v4, UUID v7, ULID, and NanoID identifiers.
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
Paste the UUID string: f47ac10b-58cc-4372-a567-0e02b2c3d479
The tool validates RFC 4122 compliance — checks version nibble, variant bits, and hex format
Display the version (4 = random) and variant (1 = RFC 4122)
Confirm the UUID is valid and suitable for database insertion
Valid UUID v4 (random), variant: RFC 4122 (10xx), 122 bits of entropy, suitable for database primary keysPaste the UUID string: 550e8400-e29b-41d4-a716-446655440000
Select 'String to Binary' conversion mode
The tool outputs the 16-byte binary representation: 85 14 e8 40 0e 29 b4 1d 4a 71 64 46 65 54 00 00
Use the binary format for database storage or binary protocol transmission
8514e8400e29b41d4a71644665544000 — 16-byte hex representation for binary storageCode Examples
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, ... }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-446655440000UUID Version Detection
| Version Nibble (byte 6, high) | Version | Generation Method | Contains Timestamp? |
|---|---|---|---|
| 0001 | v1 | Timestamp + MAC address | Yes (60-bit, 100ns intervals) |
| 0011 | v3 | MD5(namespace + name) | No |
| 0100 | v4 | Random (CSPRNG) | No |
| 0101 | v5 | SHA-1(namespace + name) | No |
| 0110 | v6 | Reordered timestamp | Yes |
| 0111 | v7 | Unix epoch + random | Yes (48-bit milliseconds) |
| 1000 | v8 | Custom/vendor-specific | Varies |
UUID Format Conversions
| Input Format | Output Format | Example | Use Case |
|---|---|---|---|
| String | Binary (16 bytes) | f47ac10b-58cc-... → 8514e840... | Database storage, binary protocols |
| Binary | String | 8514e840... → f47ac10b-58cc-... | Display, API responses, logs |
| String | URN | f47ac10b-... → urn:uuid:f47ac10b-... | XML, RDF, namespace compliance |
| URN | String | urn:uuid:f47ac10b-... → f47ac10b-... | Parsing, validation |
| String | No-dash | f47ac10b-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
Debugging database issues where malformed UUIDs cause silent insert failures or constraint violations.
Parsing UUIDs from third-party API responses to extract version, timestamp, and validity metadata.
Converting UUID representations during database migrations between systems that require different formats.
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
References & Further Reading
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.
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.
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.
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 Generation Tools
Explore these related generation tools:
- UUID Generator — Dedicated UUID v4 generation tool.
- ULID Generator — Dedicated ULID generation with timestamp sorting.
- NanoID Generator — Compact, customizable identifier generation.
- Random Bytes Generator — Generate raw random bytes for custom identifier formats.
- Secret Token Generator — Generate secure tokens for authentication (not identifiers).