UUID Without Dashes — How to Remove Hyphens in Every Language
- UUID without dashes = same 32 hex characters, no separators: 550e8400e29b41d4a716446655440000
- JavaScript: crypto.randomUUID().replace(/-/g, "")
- Python: uuid.uuid4().hex
- Use no-dash format only if the receiving system requires it — standard format is preferred everywhere else
Table of Contents
A UUID without dashes is the same 32 hexadecimal characters as a standard UUID — just without the four hyphen separators. Standard: 550e8400-e29b-41d4-a716-446655440000. No-dash: 550e8400e29b41d4a716446655440000. Here is how to produce either format in every major language, and when each is appropriate.
When to Use UUID Without Dashes
The hyphenated format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) is the canonical RFC 4122 standard. Use it by default unless a specific system requires otherwise.
Use no-dash format when:
- The target column is
CHAR(32)orVARCHAR(32)— sized for the compact form - A third-party API or system explicitly requires a 32-character hex string
- You are embedding the UUID in a URL and want to save 4 characters
- A legacy system was built expecting the compact form
- Generating tokens or API keys where you want an opaque string without visual separators
Keep the dashes when:
- Storing in a database with a native UUID type (PostgreSQL, SQL Server — they handle either format)
- Sharing IDs in logs or debugging contexts — hyphens make UUIDs visually scannable
- Any system that follows RFC 4122 (which most do)
Strip UUID Dashes in Every Language
// JavaScript
const uuid = crypto.randomUUID().replace(/-/g, '');
// '550e8400e29b41d4a716446655440000'
// Python
import uuid
no_dashes = uuid.uuid4().hex # built-in .hex property
no_dashes = str(uuid.uuid4()).replace('-', '') # alternate
# Java
import java.util.UUID;
String id = UUID.randomUUID().toString().replace("-", "");
# C# / .NET
string id = Guid.NewGuid().ToString("N");
// "N" format specifier = no dashes, lowercase
string upper = Guid.NewGuid().ToString("N").ToUpper();
# Go (google/uuid)
import "github.com/google/uuid"
u := uuid.New()
noHyphens := strings.ReplaceAll(u.String(), "-", "")
# PHP
$uuid = str_replace('-', '', (string) Str::uuid()); // Laravel
$uuid = str_replace('-', '', sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', ...));
# Bash/Shell
uuidgen | tr -d '-'
# PowerShell
[guid]::NewGuid().ToString('N') # 'N' = no dashes
[guid]::NewGuid().ToString().Replace('-', '')
Sell Custom Apparel — We Handle Printing & Free Shipping
Remove UUID Dashes in SQL
-- PostgreSQL SELECT REPLACE(gen_random_uuid()::text, '-', ''); -- '550e8400e29b41d4a716446655440000' -- MySQL SELECT REPLACE(UUID(), '-', ''); -- SQL Server SELECT REPLACE(CAST(NEWID() AS VARCHAR(36)), '-', ''); -- or use format specifier (no equivalent in TSQL — use REPLACE)
Important for SQL Server: If you need a GUID without dashes for a stored value, store it as CHAR(32). Note that SQL Server's UNIQUEIDENTIFIER type always stores and displays with dashes — to store without dashes you must use a character type and handle conversion in application code.
Add Dashes Back to a No-Dash UUID String
If you receive a 32-character no-dash UUID and need to restore standard format:
// JavaScript — add dashes back
function addUUIDDashes(s) {
return s.replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, '$1-$2-$3-$4-$5');
}
addUUIDDashes('550e8400e29b41d4a716446655440000');
// '550e8400-e29b-41d4-a716-446655440000'
# Python
def add_dashes(s):
return '-'.join([s[:8], s[8:12], s[12:16], s[16:20], s[20:]])
add_dashes('550e8400e29b41d4a716446655440000')
# '550e8400-e29b-41d4-a716-446655440000'
For a quick no-dash UUID right now, the WildandFree UUID Generator generates standard UUID v4 — copy it, strip the dashes with one of the patterns above.
Generate a UUID and Strip the Dashes
Get a UUID v4 in one click — then use any of the patterns above to remove the dashes for your system. No signup, no download, works everywhere.
Open Free UUID GeneratorFrequently Asked Questions
Is a UUID without dashes still a valid UUID?
It is the same identifier — same 128 bits, same uniqueness guarantees. Whether it is "valid" depends on the receiving system. RFC 4122 defines the hyphenated format as canonical, but most UUID parsers accept both forms. Python's uuid.UUID() accepts both. PostgreSQL's UUID type accepts both.
What is the N format specifier in C#?
Guid.ToString("N") in C# / .NET produces a 32-character lowercase hex string with no dashes, braces, or parentheses. Other format specifiers: "D" = standard with dashes (default), "B" = with braces {}, "P" = with parentheses (), "X" = hexadecimal with 0x prefix.
Should I store UUID with or without dashes in a VARCHAR column?
If you must use VARCHAR, CHAR(36) with dashes is the standard. CHAR(32) without dashes saves 4 bytes per row — negligible for most tables. The more important choice is whether to use VARCHAR at all vs. a native UUID type (PostgreSQL UUID, SQL Server UNIQUEIDENTIFIER) which both store as 16 bytes regardless of dash format.

