artisan.dev

UUID v4 Generator

Format
Count:
Click Generate to create UUIDs

How to generate UUIDs in bulk

This UUID generator creates version 4 UUIDs — random 128-bit identifiers — using the browser's crypto.randomUUID(), which draws from a cryptographically secure random source. Generate 1, 5, 10 or 50 at a time and copy them individually or all at once.

Pick the output format that matches where the IDs are going: standard lowercase with hyphens, no hyphens, uppercase, or the brace-wrapped style used by .NET and the Windows registry.

How to use it

  1. Choose a format: Standard, No hyphens, Uppercase, or .NET / C#.
  2. Choose how many UUIDs to generate.
  3. Click generate and copy the results — one per line, ready to paste into a SQL seed script, a test fixture or a spreadsheet.
FormatExampleTypical use
Standard550e8400-e29b-41d4-a716-446655440000APIs, PostgreSQL uuid, most libraries
No hyphens550e8400e29b41d4a716446655440000Compact keys, file names, some MySQL schemas
Uppercase550E8400-E29B-41D4-A716-446655440000Systems that expect uppercase hex
.NET / C#{550E8400-E29B-41D4-A716-446655440000}Guid.Parse, registry keys, COM

What is a UUID v4?

A UUID is 128 bits written as 32 hex digits in the pattern 8-4-4-4-12. In a version 4 UUID, 122 of those bits are random; the remaining six mark the version (the 4 at the start of the third group) and the variant (8, 9, a or b at the start of the fourth group). Because the space is so large — about 5.3 × 10^36 possible values — you can generate IDs on any machine without coordination and practically never collide.

To put the odds in perspective: you'd need to generate roughly 2.7 quintillion v4 UUIDs to reach a 50% chance of a single duplicate. Real-world collisions come from broken random number generators, not chance.

UUIDs in your database

  • PostgreSQL: store in the native uuid column type (16 bytes). gen_random_uuid() generates v4 server-side.
  • MySQL: store as BINARY(16) using UUID_TO_BIN() rather than CHAR(36) to save space and speed up indexes.
  • Primary keys on large tables: random v4 values scatter inserts across the index. If insert performance matters, consider time-ordered UUIDv7 — see UUID versions explained.
  • Don't use UUIDs as secrets. They're unique, not secret. For tokens and keys, use the password generator.

Generating UUIDs in code

// JavaScript (browsers and Node.js 19+)
crypto.randomUUID();

# Python
import uuid; str(uuid.uuid4())

// Go (github.com/google/uuid)
uuid.NewString()

-- PostgreSQL 13+
SELECT gen_random_uuid();

Validating a UUID

To check that a string is a well-formed UUID before storing it, match the 8-4-4-4-12 hex layout and, if you only accept standard versions, the version and variant digits. You can try the pattern in the regex tester:

/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i

Most languages also have a parser that does this for you — uuid.UUID(s) in Python, UUID.fromString(s) in Java, Guid.TryParse in .NET — and PostgreSQL rejects invalid values in a uuid column automatically.

Frequently asked questions

Are these UUIDs unique?

Yes, for all practical purposes. They contain 122 random bits from a cryptographically secure generator, so the chance of a duplicate is negligible even across billions of IDs.

What's the difference between a UUID and a GUID?

They're the same thing. GUID is Microsoft's term; .NET often shows GUIDs in uppercase inside braces, which the .NET / C# format produces.

Can I generate UUID v7 here?

Not yet — this tool generates v4. UUIDv7 embeds a timestamp and is better suited to database primary keys; most languages have a library for it, and PostgreSQL 18 has a built-in uuidv7().

Are uppercase and lowercase UUIDs the same?

Yes. UUIDs are case-insensitive, though the canonical form is lowercase. Compare them case-insensitively, or normalise to lowercase before storing.

Further reading

Related tools