UUID Hyphen Converter

Convert single or bulk UUIDs between compact 32-character hex format and canonical 8-4-4-4-12 hyphenated strings.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
Input UUIDs (One per line)
0 lines · 0 charsHyphenated
Formatted UUIDs
0 lines · 0 charsCompact

Why Convert UUID Formats?

UUIDs (Universally Unique Identifiers) are 128-bit numerical labels defined by IETF specifications RFC 4122 and RFC 9562. While mathematical identity relies purely on the 16 bytes of binary data, practical storage and transport demand distinct text representations:

Standard Canonical Format

Represented as 36 characters with hyphens (e.g. 8-4-4-4-12). Ideal for logging, JSON APIs, and PostgreSQL UUID column types.

Compact 32-Character Hex

Hyphens stripped away. Ideal for MySQL BINARY(16) conversions, URL path parameters, and compact cache keys.

100% Client-Side Privacy

All string manipulation happens in browser memory. Sensitive customer IDs, user keys, and tokens are never transmitted to any external server.

The RFC 4122 and RFC 9562 Canonical Layout

The canonical representation separates 32 hexadecimal digits into 5 hyphen-delimited segments formatted as 8-4-4-4-12:

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
|      | |  | |  | |  | |          |
time_low |    |    |  | node (48-bit)
     time_mid |    clock_seq_hi / variant (N)
          time_hi / version (M)

In modern UUID variants such as UUID v4 (pseudo-random) and UUID v7 (Unix Epoch time-ordered), these hyphen positions are retained strictly for backward compatibility with parsers expecting the 36-character format.

Storage Efficiency Across Databases

Choosing whether to store UUIDs as hyphenated strings, compact hex, or raw bytes has dramatic impacts on B-Tree index performance and disk consumption:

Storage Type Format Example Bytes per Row Index Overhead Database Best Practice
Canonical String 123e4567-e89b-12d3... 36 bytes (+1-4 length byte) High (poor cache locality) PostgreSQL (auto-packed to 16B)
Compact String 123e4567e89b12d3... 32 bytes (+1-4 length byte) Moderate (11.1% smaller than canonical) Legacy databases without native UUID
Binary Byte Array \x12\x3e\x45\x67... 16 bytes fixed Minimal (optimal) MySQL BINARY(16), SQLite BLOB

Programmatic Code Snippets

To perform these conversions in your application backend without external libraries:

Node.js / TypeScript

// Remove hyphens (canonical to compact)
const compact = uuid.replace(/-/g, '');

// Add hyphens (compact to canonical)
const canonical = compact.replace(/^([0-9a-f]8)([0-9a-f]4)([0-9a-f]4)([0-9a-f]4)([0-9a-f]12)$/i, '$1-$2-$3-$4-$5');

Python

import uuid

# Parse any format and output compact or canonical
u = uuid.UUID("123e4567-e89b-12d3-a456-426614174000")
compact = u.hex        # '123e4567e89b12d3a456426614174000'
canonical = str(u)     # '123e4567-e89b-12d3-a456-426614174000'
binary = u.bytes       # 16 raw bytes for database insert

MySQL 8.0+

-- Insert as optimal BINARY(16) with time-ordered swapping
INSERT INTO users (id, name) VALUES (UUID_TO_BIN('123e4567-e89b-12d3-a456-426614174000', 1), 'Alice');

-- Retrieve as standard hyphenated string
SELECT BIN_TO_UUID(id, 1) AS id, name FROM users;

Frequently Asked Questions

Why do canonical UUIDs have hyphens?
RFC 4122 and RFC 9562 define the canonical string representation of a 128-bit UUID as 32 hexadecimal digits formatted in five groups: 8-4-4-4-12 (e.g., 123e4567-e89b-12d3-a456-426614174000). The hyphens historically demarcated distinct fields from the UUID v1 architecture: time_low, time_mid, time_hi_and_version, clock_seq, and the 48-bit node identifier.
How much database storage does stripping hyphens save?
When stored as a plain text string (VARCHAR or CHAR), stripping hyphens reduces size from 36 bytes down to 32 bytes (an 11.1% storage saving). However, storing UUIDs in native binary types like PostgreSQL UUID or MySQL BINARY(16) reduces disk consumption to exactly 16 bytes, cutting index overhead by 55.5%.
Are compact UUIDs without hyphens valid in APIs?
Yes. The hyphens in UUIDs are purely a visual and parsing convention. The underlying data payload is an identical 128-bit number. Many REST APIs, URLs, and NoSQL databases prefer compact 32-character hex representations to save bandwidth and prevent delimiter confusion in URL routes.
How do I convert between hyphenated and compact UUIDs in SQL?
In MySQL 8.0+, use UUID_TO_BIN(uuid, 1) to convert to binary and BIN_TO_UUID(bin, 1) to retrieve. In older versions, use UNHEX(REPLACE(uuid, "-", "")) to strip and HEX(bin) to restore. In PostgreSQL, casting between UUID and TEXT automatically handles hyphens.
Is it safe to paste confidential production UUIDs here?
Yes, 100% safe. Processing executes entirely in your browser memory via native JavaScript string manipulation. No data is sent across the network, no cookies or tokens are saved, and nothing touches remote logging servers.

About This Tool

Strips or adds hyphens across single or bulk UUIDs, one per line, auto-cleaning urn:uuid: prefixes and {braces} before reformatting. Paste a mixed batch of canonical and compact IDs and each line is parsed and converted independently.

It only reformats punctuation and casing on already-valid UUIDs; it doesn't generate new ones (see UUID Generator) and it doesn't validate RFC version/variant bits, only that the hex payload is exactly 32 characters.

Key Features

  • Bulk, line-by-line: paste any number of UUIDs and each is parsed and converted on its own.
  • Add or remove hyphens: swap between compact 32-char hex and canonical 8-4-4-4-12, including a direction-swap button.
  • Casing control: Preserve, lowercase, or UPPERCASE output.
  • Braces & URN affixes: optional {wrap} or urn:uuid: prefix on output.
  • Input auto-cleanup: strips existing urn:uuid: prefixes, braces, and non-hex characters before validating.
  • Per-line validation: flags exactly how many lines failed to parse as valid 32-character UUIDs.