DeveloperUtilityTools

UUID Format Converter

Convert UUIDs between different common formats used by databases, APIs, and display layers.

UUID Format Converter

{uuid}

urn:uuid:...

What is UUID Format Conversion?

UUID format conversion transforms the same 128-bit UUID value between different textual representations used by various systems, databases, and APIs. While the underlying UUID remains identical, different platforms and use cases prefer different string formats: the canonical hyphenated lowercase format (8-4-4-4-12), compact format without hyphens, uppercase variants, URN format with "urn:uuid:" prefix, or Microsoft's braced format with curly braces.

Converting between formats is essential when integrating systems that use different UUID conventions. For example, PostgreSQL's UUID type stores and returns UUIDs in lowercase hyphenated format, while some Java systems use uppercase, and certain APIs expect compact format for URL efficiency. Format conversion ensures compatibility across your technology stack without changing the actual identifier values.

This converter handles all common UUID representations, providing instant conversion between formats. It normalizes input (accepting any valid format), validates UUID structure, and outputs all standard formats simultaneously. This makes it easy to adapt UUIDs for different systems, debug format mismatches, or understand how your identifiers appear in different contexts.

Common Use Cases for UUID Format Conversion

Database Integration

Convert UUIDs to match database requirements. PostgreSQL uses lowercase hyphenated format, MySQL BINARY(16) requires compact hex, SQL Server UNIQUEIDENTIFIER accepts braced format. Converting ensures your UUIDs are stored correctly and queries match expected formats, preventing "UUID not found" errors from format mismatches.

API Compatibility

Normalize UUIDs for REST APIs that expect specific formats. Some APIs require lowercase canonical format, others accept compact for URL efficiency. Converting ensures requests succeed and prevents rejection due to format violations. Important when integrating with third-party services or standardizing across microservices.

URL and URI Construction

Convert to compact format for shorter URLs or to URN format for semantic web applications. Compact format reduces URL length by 4 characters, important for character-limited contexts. URN format (urn:uuid:...) is used in RDF, XML namespaces, and formal specifications requiring full URI notation.

Legacy System Migration

Convert UUIDs when migrating between systems with different format conventions. Legacy Windows systems use uppercase braced format, modern APIs prefer lowercase hyphenated. Format conversion during ETL processes ensures data consistency and prevents identifier mismatches after migration.

Display and Logging

Standardize UUID display format for consistency in logs, user interfaces, and documentation. Convert all UUIDs to canonical lowercase hyphenated format for readability, or to uppercase for visual distinction. Consistent formatting improves debugging and user experience.

Storage Optimization

Convert to compact format for space-efficient storage in constrained environments. Removes 4 hyphen characters, reducing storage from 36 to 32 bytes per UUID. Important for large-scale systems storing millions of UUIDs where every byte counts, or for bandwidth-limited APIs.

UUID Format Types Explained

Canonical (Hyphenated Lowercase)

The RFC 4122 standard format: 8-4-4-4-12 groups of lowercase hexadecimal digits separated by hyphens. Total length: 36 characters. This is the most widely used and recommended format.

550e8400-e29b-41d4-a716-446655440000

Use this format for: APIs, databases with native UUID support (PostgreSQL), logging, and general-purpose display. It's the most human-readable and universally compatible.

Uppercase (Hyphenated Uppercase)

Same structure as canonical but with uppercase hexadecimal digits. Some systems prefer this for consistency or visual distinction.

550E8400-E29B-41D4-A716-446655440000

Use this format for: systems with uppercase conventions, SQL Server in some contexts, or when uppercase is your organizational standard. Functionally identical to lowercase.

Compact (No Hyphens)

32 hexadecimal digits with no separators. More space-efficient but less readable. Used when storage space or URL length matters.

550e8400e29b41d4a716446655440000

Use this format for: binary storage representations, compact URLs, cache keys, or systems that don't require hyphens. Save 4 bytes per UUID, which adds up at scale.

URN (Uniform Resource Name)

Canonical format prefixed with "urn:uuid:" to create a valid URN. Used in semantic web, XML namespaces, and formal specifications.

urn:uuid:550e8400-e29b-41d4-a716-446655440000

Use this format for: RDF documents, XML schema references, SOAP messages, or any context requiring formal URI notation for identifiers.

Braced (Microsoft Format)

Canonical format wrapped in curly braces. Traditional Microsoft GUID representation, especially in Windows APIs and older .NET code.

{550e8400-e29b-41d4-a716-446655440000}

Use this format for: Windows COM interfaces, legacy .NET applications, SQL Server UNIQUEIDENTIFIER in some contexts, or when integrating with Microsoft ecosystems requiring braced GUIDs.

Frequently Asked Questions

Does format conversion change the UUID value?

No. Format conversion only changes the textual representation, not the underlying 128-bit value. All formats represent the exact same UUID. Converting between formats is like writing the same number in different notations (123 vs 0x7B)—the value is identical, only the display changes. The UUID remains functionally equivalent across all formats.

Which format should I use for storage?

Use native UUID types when available (PostgreSQL UUID, SQL Server UNIQUEIDENTIFIER) which handle format internally. For databases without native support: use BINARY(16) with compact format for space efficiency, or CHAR(36) with canonical lowercase for readability and debugging. Document your choice and be consistent across your application to avoid conversion overhead and confusion.

Are uppercase and lowercase UUIDs considered equal?

Yes, they're the same UUID. However, some systems treat them as different strings in comparisons. Best practice: normalize to lowercase canonical format for storage and comparison to prevent duplicates. For example, without normalization, you might accidentally treat "550E8400-..." and "550e8400-..." as different records in case-sensitive systems.

Should I convert UUIDs before database insertion?

Depends on your database. PostgreSQL's UUID type accepts any valid format and normalizes automatically. For string columns (CHAR/ VARCHAR), normalize to your standard format before insertion for consistency. For BINARY columns, convert to compact format and then to binary. Consistent formatting prevents query issues and duplicate key violations from format differences.

Why do some APIs reject certain UUID formats?

APIs enforce format standards for consistency and parsing reliability. Strict APIs may only accept canonical lowercase hyphenated format, rejecting uppercase, compact, or braced variants. This ensures predictable parsing and prevents ambiguity. Always check API documentation for format requirements and convert accordingly before making requests.

How do I convert UUIDs programmatically?

Most languages provide UUID libraries with format conversion: JavaScript uuid library has formatting options, Python uuid module supports str() and hex properties, Java's UUID class has toString(), C#'s Guid has ToString(format). For custom formats, normalize to lowercase, remove/add hyphens as needed, and wrap with prefixes/ suffixes. Regex can help but libraries are more reliable.

Does format affect UUID performance?

Slightly. Compact format saves 4 bytes per UUID, reducing storage and network transfer costs at scale. Binary storage (16 bytes) is most efficient. String formats have similar performance for comparison operations. The real performance impact comes from indexing strategies (time-ordered vs random UUIDs), not format choice. Choose format based on compatibility and readability, not performance.

When should I use URN format?

Use URN format when UUIDs need to be formal URIs in semantic web contexts, RDF/OWL ontologies, XML namespaces, or specifications requiring full URI notation. For regular APIs and databases, stick to canonical hyphenated format. URN format is verbose and mainly for formal/academic contexts where URIs are required, not everyday application development.

Can I safely convert between formats repeatedly?

Yes, format conversion is lossless and repeatable. Converting canonical → compact → uppercase → URN → braced → back to canonical yields the exact same UUID. There's no degradation or loss of information. However, repeated conversions waste CPU cycles. Convert once at system boundaries and store in your preferred format to avoid unnecessary processing.

What happens if I mix formats in my database?

Mixing formats causes problems: duplicate records (same UUID in different formats treated as different values), failed queries (searching for lowercase doesn't find uppercase), broken foreign key relationships, and debugging nightmares. Always normalize to one format at input boundaries. Use database constraints or triggers to enforce format consistency. Better yet, use native UUID types that handle this automatically.

Best Practices for UUID Format Management

Standardize on one format per system: Choose canonical lowercase hyphenated format as your default unless you have specific requirements. Document this standard in your API documentation, database schema comments, and code style guides. Consistency prevents conversion errors, simplifies debugging, and improves team productivity.

Normalize at entry points: Convert all incoming UUIDs to your standard format at API boundaries, file imports, and user inputs. This creates a trusted zone where all UUIDs are consistently formatted. Never assume external sources use your format—always validate and normalize.

Use native UUID types when possible: PostgreSQL UUID, SQL Server UNIQUEIDENTIFIER, and similar native types handle format conversion automatically. They accept any valid format on input and normalize internally. This eliminates conversion bugs and simplifies application code. Only use string types when native support is unavailable.

Document format requirements clearly: In API documentation, specify accepted UUID formats explicitly. Don't just say "UUID"—say "canonical lowercase hyphenated format (8-4-4-4-12)" with examples. This prevents integration issues and support requests. Include format requirements in error messages when validation fails.

Avoid format conversion in hot paths: Convert once at system boundaries, not repeatedly in loops or frequently-called functions. Cache converted formats if needed multiple times. While conversion is fast, eliminating unnecessary conversions improves performance at scale. Profile your code to identify conversion bottlenecks.

Test cross-platform compatibility: If your system integrates with multiple platforms (PostgreSQL + .NET + Java), verify UUID format handling across all systems. Test that UUIDs round-trip correctly through your entire stack. Automated integration tests should validate format consistency end-to-end.

Related UUID Tools

Explore our complete suite of UUID tools for generation, validation, decoding, and format conversion: