How to Generate a UUID:
Step-by-Step Tutorial
Generate one UUID or a batch of 100 in under a minute — in the browser, from the command line, or in code. Includes fixes for the most common UUID errors.
This tutorial shows you how to generate one UUID or a batch of up to 100, in your browser, with no signup and no install. It takes about a minute. It also covers how to do the same thing from the command line and in code, and how to fix the most common problems people hit with UUIDs.
Step 1: Open the UUID Generator
Go to the UUID Generator. The tool runs entirely in your browser — nothing you generate is sent to a server. It produces UUID v4 identifiers, the random-number-based version that covers almost every practical use: database keys, request IDs, file names, correlation IDs in logs.
A UUID v4 looks like this:
550e8400-e29b-41d4-a716-446655440000
That's 36 characters: 32 hexadecimal digits plus 4 hyphens, arranged in a fixed 8-4-4-4-12 pattern. The first character of the third group is always 4 (the version number), and the first character of the fourth group is always 8, 9, a, or b (the variant). Everything else is random.
Step 2: Choose How Many UUIDs You Need
Use the Number of UUIDs dropdown to pick a count: 1, 5, 10, 20, 50, or 100. One is enough if you just need a key for a config file or a test record. Pick 50 or 100 when you're seeding a database or writing fixtures — generating them in one batch beats clicking the button fifty times.
There's also an Uppercase checkbox. UUIDs are case-insensitive by definition (RFC 4122 says to generate lowercase but accept both), so this is purely a formatting choice. Two common reasons to check it: your database stores UUIDs uppercase and you want visual consistency when comparing, or a legacy system (Windows registry GUIDs, some .NET code) expects uppercase.
Step 3: Generate and Copy
Click Generate. The output panel fills with your UUIDs, one per line:
3f2c8a1e-9b4d-4c7a-8e2f-1d5b6a9c0e3f
7a1b3c5d-2e4f-4a6b-9c8d-0e1f2a3b4c5d
b9e8d7c6-5a4b-4c3d-a2e1-f0a9b8c7d6e5
Then either:
- Copy All — puts every generated UUID on your clipboard, ready to paste into code or a spreadsheet.
- Download — saves them as a
uuids.txtfile. Useful for batches you want to keep, like pre-allocated IDs for a data import.
Each click of Generate produces a fresh set. There is no way to "re-generate" the same UUID — that's the point of them. If you need to keep one, copy it before generating again.
Worked Example: Seeding a Test Database
Say you're writing a SQL seed script and need 3 stable user IDs. Generate 3 UUIDs, copy them, and paste into your script:
INSERT INTO users (id, name) VALUES
('3f2c8a1e-9b4d-4c7a-8e2f-1d5b6a9c0e3f', 'Test User A'),
('7a1b3c5d-2e4f-4a6b-9c8d-0e1f2a3b4c5d', 'Test User B'),
('b9e8d7c6-5a4b-4c3d-a2e1-f0a9b8c7d6e5', 'Test User C');
Because the IDs are hardcoded in the seed file, your integration tests can reference '3f2c8a1e-…' directly instead of querying for "the first user". This makes tests deterministic while the IDs themselves remain valid, well-formed UUIDs that pass any format validation in your code.
Generating UUIDs Without the Tool
When you're already in a terminal or writing code, generate UUIDs directly:
Command line
# macOS and most Linux distros
uuidgen
# → 6B29FC40-CA47-1067-B31D-00DD010662DA (macOS outputs uppercase)
# Linux, lowercase, always available if util-linux is installed
cat /proc/sys/kernel/random/uuid
# PowerShell (Windows)
[guid]::NewGuid()
In code
// JavaScript (Node 19+, all modern browsers)
crypto.randomUUID()
# Python 3
import uuid
str(uuid.uuid4())
-- PostgreSQL 13+
SELECT gen_random_uuid();
All of these produce UUID v4 using a cryptographically secure random source, same as the online tool. Use the tool when you need a quick batch without opening a terminal; use code when UUIDs are generated at runtime as part of your application logic.
Common Problems and Fixes
"Invalid UUID" errors when pasting into a database
Check for three things: a trailing newline or space picked up during copy, curly braces around the value ({550e8400-…} is the Microsoft GUID string format — strip the braces for PostgreSQL and MySQL), and accidentally truncated characters. A valid UUID is exactly 36 characters with hyphens at positions 9, 14, 19, and 24.
UUID rejected by a strict v4 validator
Some validators check the version and variant bits, not just the shape. If your regex-generated "fake UUID" fails, it's probably missing the 4 at position 15 or has an invalid variant character at position 20. UUIDs from this tool always have both set correctly. You can check any UUID's structure with the Regex Tester using the pattern ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$.
Worried about duplicates in a batch of 100
Don't be. UUID v4 has 122 random bits, which means 2122 ≈ 5.3 × 1036 possible values. You would need to generate about 2.7 × 1018 UUIDs — a billion per second for 85 years — to reach a 50% chance of a single collision. A batch of 100 is nowhere near that.
UUIDs slow down my database index
This one is real. Random UUIDs as primary keys cause index fragmentation in B-tree indexes because inserts land at random positions. If insert performance matters, look at UUID v7 (time-ordered, standardized in RFC 9562) or use a bigint sequence internally and expose the UUID only in APIs. For public-facing short IDs, a Nano ID is 21 characters instead of 36 and fits URLs better.
FAQ
Is it safe to use an online UUID generator?
For this tool, yes — generation happens in your browser with crypto.getRandomValues(), and no UUID leaves your machine. That said, UUIDs are identifiers, not secrets. Never use a UUID as a password, API key, or session token; use the Password Generator for secrets.
What's the difference between UUID and GUID?
Nothing meaningful. GUID (Globally Unique Identifier) is Microsoft's name for the same 128-bit identifier. The only practical difference is formatting convention: Microsoft tooling often wraps GUIDs in braces and uppercases them.
Should I use UUID v1 or v4?
Use v4 unless you have a specific reason not to. UUID v1 embeds the generator's MAC address and a timestamp, which leaks information about where and when it was created — this is how investigators traced the author of the Melissa virus in 1999. v4 is pure randomness. If you want sortable IDs, use v7 rather than v1.
Can I shorten a UUID?
Not without losing its guarantees. A UUID re-encoded in base64 drops to 22 characters but is no longer recognizable or parseable as a UUID by standard libraries. If length matters, generate a Nano ID or a random string at the length you need instead.