UUID Generator
Format options
Count
Free online UUID/GUID/ULID/NanoID generator supporting 5 unique ID formats, bulk generation up to 100, customizable formatting, and UUID validation. Ready to use instantly—perfect for database primary keys and test data creation.
Related
What is a UUID?
UUID (Universally Unique Identifier) is a 128-bit identifier standardized by the Open Software Foundation (OSF), defined in RFC 4122. Its purpose is to allow distributed systems to uniquely identify information without a central authority for ID assignment.
A standard UUID looks like `550e8400-e29b-41d4-a716-446655440000`, composed of 32 hexadecimal digits split into 5 groups (8-4-4-4-12) by hyphens. Theoretically, the collision probability of UUID v4 is about 1/10^36—if you generated 1 billion UUIDs per second for about 800 years, the probability of a single collision would be approximately 50%, which is negligible in practice.
UUIDs are widely used for database primary keys, distributed trace IDs, request IDs, log trace IDs, unique file naming, test data IDs, and session identifiers. Nearly all mainstream programming languages include built-in UUID generation libraries.
Use Cases
- Generate UUID v4 as table record primary keys during database design to avoid data volume leakage from auto-increment IDs
- Use ULID as sortable global request/trace IDs in distributed systems or microservice architectures
- Bulk generate UUIDs as test data and mock order/user IDs during API development and integration testing
- Use NanoID instead of UUID in frontend short links or share URLs—shorter, cleaner, no URL encoding needed
- Use UUID v5 to generate deterministic IDs from fixed namespaces, ensuring same input always produces same output
- Use the validation feature to identify ID type and version when encountering unknown-format IDs in debug logs or third-party documentation
How to Use
- Select the desired ID type from the cards above: UUID v4 (recommended), v1, v5, ULID, or NanoID
- If choosing UUID v5, enter a namespace string; other IDs can directly set format options
- Toggle uppercase and hyphen options as needed, set bulk generation count (1-100) via quick buttons or slider
- Click the generate button to view results—copy individually, copy all at once, or export as TXT/JSON
- To validate an existing ID, switch to the "Validate" tab and paste the ID string to get type and version info
Features
- Five ID types in one tool: UUID v1 (timestamp), v4 (random), v5 (namespace), ULID (sortable), and NanoID (URL-safe)—one tool covers all tech stack needs
- UUID validation & recognition: Switch to the Validate tab, paste any ID to identify its UUID version or detect ULID/NanoID format—fast troubleshooting during debugging
- Bulk generate up to 100: Generate any quantity from 1 to 100 IDs at once—no more manually copying one by one for test data
- Flexible formatting: Toggle uppercase and hyphens for UUIDs to match database, URL, and config file format requirements
- Export & local history: One-click copy all, export TXT/JSON files, generation history saved locally for instant recovery—bulk operations more efficient
- Client-side secure random: Uses browser crypto API for cryptographically secure random numbers, IDs never leave your device, works offline
Code Examples
Generate UUID v4 in JavaScript
javascriptModern browsers and Node.js 14.17+ have the Web Crypto API built in, allowing direct UUID v4 generation without third-party libraries.
// Modern browsers / Node.js 19+
const id = crypto.randomUUID();
console.log(id); // "550e8400-e29b-41d4-a716-446655440000"
// Node.js 14.17 - 18.x
const crypto = require('crypto');
const id = crypto.randomUUID();Bulk Generate UUIDs in Python
pythonUse Python's standard library uuid module to bulk generate multiple UUID v4s, ideal for test data preparation.
import uuid
# Generate single UUID
uid = uuid.uuid4()
print(uid)
# Bulk generate 10 UUIDs
for _ in range(10):
print(uuid.uuid4())
# Generate uppercase UUID without hyphens
print(uuid.uuid4().hex.upper())Generate UUID from Shell Command Line
bashQuickly generate UUIDs in Linux/macOS terminal, suitable for use in shell scripts.
# Linux uuidgen # macOS uuidgen | tr 'A-Z' 'a-z' # Direct read from system random file (most raw method) cat /proc/sys/kernel/random/uuid
Which Unique ID Scheme Should You Choose?
UUID isn't the only option—database auto-increment IDs and Snowflake are also mainstream primary key schemes. Decide first based on 'data scale, need for global uniqueness, and need for time-based sorting' to avoid many detours.
UUID v1 / v4 / v5 / ULID / NanoID: Which Should You Pick?
All 5 IDs have trade-offs in data scale, sortability, and character length. Decide based on 'where it's used + whether sorting is needed + whether it's used directly in URLs'—more reliable than focusing on the numbers themselves.
| Scheme | Recommended Scenario | Sortability | Length | Recommendation |
|---|---|---|---|---|
UUID v1 | Internal systems needing time-ordering and able to accept MAC address and generation time leakage | Time-ordered | 36 chars | ⚠ Generally not recommended (privacy leakage) |
UUID v4 | Database primary keys, general identifiers, most business scenarios | Unordered (random) | 36 chars | ✓ Universal first choice |
UUID v5 | Scenarios requiring deterministic output (same input → same UUID) | Unordered | 36 chars | ✓ Recommended when namespace is fixed |
ULID | Distributed system primary keys, log tracing, indexes needing time-based ordering | Time-ordered (first 48 bits are millisecond timestamp) | 26 chars | ✓ First choice for distributed systems |
NanoID | URL short links, cookie identifiers, frontend JS references | Unordered (random) | 21 chars (default) | ✓ First choice for short ID scenarios |
UUID vs Database Auto-Increment ID vs Snowflake ID: How to Choose a Primary Key?
These three are the most common backend primary key schemes, determining a system's scalability, concurrency safety, and performance characteristics. Deciding based on 'data scale / global uniqueness requirement / readability' can avoid later architecture changes.
| Dimension | UUID | Database Auto-Increment ID | Snowflake |
|---|---|---|---|
Global Uniqueness | ✓ Yes (theoretically) | ✗ No (duplicates after database sharding) | ✓ Yes (guaranteed by data center + worker ID) |
Data Volume Leakage | ✓ No leakage | ✗ Direct leakage (incrementing 1, 2, 3 reveals real data volume) | ⚠ Time bits reveal generation time (not direct total volume) |
Sortability | ✗ Unordered (ULID is an exception) | ✓ Monotonically increasing (B-Tree friendly) | ✓ Trending increase (ordered within the same millisecond) |
Sharding Support | ✓ Native support | ✗ Requires an ID generator or refactoring | ✓ Distinguishable via worker ID |
Storage Cost | ⚠ High (BINARY(16) is 16 bytes) | ✓ Low (BIGINT is 8 bytes) | ✓ Low (BIGINT is 8 bytes) |
Suitable Scenarios | Multi-service/distributed primary keys, external identifiers, data-volume-sensitive business | Monolithic apps, admin backends, no need for global uniqueness | High-concurrency IM, order numbers, message IDs (requires custom implementation) |
Best Practices
For production database primary keys, prefer UUID v4 or ULID, avoid v1
The last 48 bits of UUID v1 are the MAC address, and the first 48 bits are a 100ns-precision timestamp—**these two fields can be reversed back into a machine fingerprint and the generation time**. RFC 4122 clearly states v1 should be used 'only when backward compatibility is needed'. In production, prefer v4 (random) or ULID (sortable); use v1 only occasionally when debugging or needing to trace the generating machine. **Never** use v1 as externally exposed user IDs, device IDs, or order numbers.
How to choose between UUID v1, v4, and v5?UUID length is 128 bit ≠ entropy: v4 only has 122 bit of true randomness
Although UUID v4 has 128 bits in total, **the first 4 bits are the version number (fixed as 0100), and the last 2 bits are the variant (fixed as 10)**—only 122 bits are truly random. This is a format constraint defined by RFC 4122—**any UUID v4 library that claims '128-bit fully random' is incorrectly implemented**. Additionally, in v4's last 64 bits, the top 2 bits of the 7th byte are also variant fields, so actual entropy is even lower. When designing systems, calculate security based on 122 bits (not 128 bits) to avoid underestimating collision risk.
RFC 4122 - UUID SpecificationStore UUIDs as BINARY(16) columns, not VARCHAR(36)
The UUID v4 string `550e8400-e29b-41d4-a716-446655440000` may look compact, but VARCHAR(36) actually stores 36 bytes + 2 bytes for length = 38 bytes, **2.4× more storage than BINARY(16)**. MySQL/PostgreSQL/MSSQL all have built-in UUID functions that support writing directly to BINARY(16), and the index size is also halved. When tables exceed 100 million rows, VARCHAR(36) primary key indexes make B-Tree height 1-2 levels taller, **degrading query performance by 30-50%**. Convert to string only for frontend display; always use BINARY(16) for transport at the business layer.
UUID / ULID / NanoID Comparison TableFor URL scenarios, use NanoID or hyphen-less UUID to avoid URL encoding
The UUID v4 character set is `[0-9a-f-]`, **and the hyphen - in URL paths requires double URL encoding** (first escape to %2D, then to %252D), which looks ugly. Two solutions: **(1) for URL scenarios, use NanoID directly** (default 21 URL-safe chars); **(2) UUID v4 with hyphens disabled** outputs 32 pure hex chars, requiring no encoding as a URL path segment. For cookie scenarios, also prefer NanoID (A-Za-z0-9_-) or hyphen-less UUID, avoiding the `+` `/` `=` characters (Base64 character set).
Can I remove hyphens or convert UUIDs to uppercase?After bulk generation, always deduplicate—generator bugs may cause duplicates
UUID v4's collision probability is about 1/10^36, so theoretically no deduplication is needed—**but in engineering, don't trust the theory**. Real incidents such as Linux kernel RNG failures, bugs in early Node.js versions' `crypto.randomUUID` implementation, and insufficient entropy during Cloud VM startup have all caused duplicates in bulk-generated UUIDs. **In production, after bulk-generating 100k+ UUIDs, you must run `SELECT id, COUNT(*) FROM t GROUP BY id HAVING COUNT(*) > 1` to deduplicate and verify**—if issues are found, immediately roll back the generator version. This is a best practice hard-won from painful lessons in data migration and bulk import scenarios.
Can I generate multiple UUIDs at once?FAQ
What's the difference between UUID and GUID?
UUID (Universally Unique Identifier) and GUID (Globally Unique Identifier) are essentially the same thing with different names: UUID is the formal IETF standard name (RFC 4122), while GUID is Microsoft's preferred term in the Windows ecosystem. Both share the identical 128-bit format like `550e8400-e29b-41d4-a716-446655440000`. Standard UUIDs generated by this tool work interchangeably in any scenario requiring GUIDs.
How to choose between UUID v1, v4, and v5?
UUID v1 is based on timestamp and MAC address—time-ordered and traceable, but may leak MAC address information. UUID v4 is completely random, the most commonly used and secure choice, suitable for most primary key and identifier scenarios. UUID v5 is a SHA-1 hash-based namespaced version—same namespace + same name always produces the same UUID, ideal for deterministic output scenarios. For general development, UUID v4 is the default choice.
What advantages do ULID and NanoID have over UUID v4?
ULID (26 chars) is shorter than UUID (36 chars with hyphens) and lexicographically sortable by creation time, making it ideal for database indexes and log tracing. NanoID (21 chars default) is even shorter and faster, using URL-safe characters so no escaping is needed in URLs and cookies—it's about 30% smaller than UUID. All three have negligible collision probability, but ULID's sortability shines in distributed systems, while NanoID is friendlier for frontend/URL scenarios.
Can I generate multiple UUIDs at once?
Yes. This tool supports bulk generation from 1 to 100 IDs. Set the count via quick buttons or the slider, then generate with one click—perfect for test data creation, bulk imports, and preparing unique IDs for scripts. After generation, you can copy all results at once or export as TXT or JSON files.
Bulk generation guideCan I validate whether a string is a valid UUID?
Yes. Switch to the "Validate" tab and paste any string—the tool automatically identifies and validates: standard UUIDs (v1/v3/v4/v5) will report their specific version number, and it also recognizes ULID (26-char Crockford Base32) and NanoID (21-char URL-safe) formats, making it very convenient for quickly troubleshooting ID format issues during development and debugging.
Is generating UUIDs online safe? Will my IDs leak to a server?
Completely safe. All ID generation and validation runs locally in your browser via JavaScript, using crypto.getRandomValues() for cryptographically secure random numbers. No generated IDs are sent to any server, and no generation history is stored in the cloud. It works even when offline, making it suitable for enterprise intranets and sensitive projects.
Can I remove hyphens or convert UUIDs to uppercase?
Yes. For UUID v1/v4/v5, the tool provides two toggles: "Uppercase" switches the output case, and "Hyphens" lets you remove the dashes (useful for URLs, config files, or databases that require hyphen-free format). ULID and NanoID have no hyphens by default and also support case switching.
Why use an online tool instead of the command line to generate UUIDs?
Command-line tools (like Linux's uuidgen, Python's uuid module) require a development environment. An online tool works instantly in your browser with no installation needed. Additionally, this tool integrates UUID version recognition, bulk export, and local history features—more convenient when working across devices (e.g., generating IDs for non-technical colleagues) or when you need IDs on the fly.
Glossary
- UUID
- Universally Unique Identifier, 128-bit length, RFC 4122 standard, common versions include v1 (timestamp+MAC), v4 (random), v5 (SHA-1 hash).
- GUID
- Globally Unique Identifier, Microsoft's term for UUID—the two are identical in format and purpose.
- ULID
- Universally Unique Lexicographically Sortable Identifier, 26 characters using Crockford Base32 encoding, first 48 bits are timestamp—sortable by creation time.
- NanoID
- A lightweight unique ID generator, 21 URL-safe characters by default (A-Za-z0-9_-), shorter and faster than UUID, ideal for frontend and URL scenarios.
- UUID v1
- Timestamp and MAC address-based UUID version, time-sortable but may leak MAC address and generation time—less secure than v4.
- UUID v4
- Completely random number-based UUID version, most widely used, negligible collision probability, the default choice in development.
- UUID v5
- SHA-1 hash-based namespaced UUID version—same namespace + same name input produces identical UUID output, suitable for deterministic scenarios.
- Collision Probability
- The probability that two randomly generated IDs are identical. UUID v4's collision probability is about 1 in 17 billion trillion, negligible in practical engineering.
- Crockford Base32
- A Base32 encoding designed by Douglas Crockford that uses uppercase letters and digits excluding I/L/O/U to avoid ambiguous characters—used by ULID.
UUID / ULID / NanoID Comparison
| Feature | UUID v4 | ULID | NanoID |
|---|---|---|---|
| Length | 36 chars (with hyphens) / 32 chars (no hyphens) | 26 chars | 21 chars (default) |
| Character Set | Hexadecimal (0-9a-f) | Crockford Base32 (32 chars) | URL-safe (64 chars) |
| Sortability | Unordered (random) | Time-ordered | Unordered (random) |
| URL-safe | Needs escaping (hyphens + alphanumeric) | Mostly safe (uppercase + digits) | Fully URL-safe |
| Generation Speed | Fast | Fast | ~60% faster than UUID |
| Collision Probability | 1/10^36 | 1/10^36 | 1/10^34 (at 21 chars) |
| Typical Use Cases | Database primary keys, general IDs | Distributed systems, log tracing | Short URLs, frontend IDs, cookies |
UUID Generation Methods by Language
| Language | Code |
|---|---|
| JavaScript | crypto.randomUUID() // Modern browsers / Node.js 19+ |
| Python | import uuid; uuid.uuid4() |
| Java | UUID.randomUUID() |
| Go | github.com/google/uuid; uuid.New() |
| Bash/Linux | uuidgen or cat /proc/sys/kernel/random/uuid |
Authoritative References
- Color Blind Simulator
- Color Converter
- .htaccess to Nginx Converter
- SQL Converter
- Cookie Parser
- Cron Expression Generator
- Cron Expression Validator
- CSS Formatter
- CSS Minifier
- CSV to Excel
- CSV Viewer
- CSV Editor
- Currency Converter
- Diff Checker
- Excel to CSV
- Favicon Generator
- CSS Formatter
- HTML Formatter
- Markdown Formatter
- XML Formatter
- Hexadecimal Converter
- HTML Formatter
- HTML Minifier
- HTML to Markdown
- Markdown to HTML
- JavaScript Formatter
- JS Minifier
- JSX Formatter
- JSX Minifier
- Keyword clustering
- Lorem Ipsum Generator
- Markdown Table Generator
- Meta Tag Generator
- Password Generator
- Password Strength Checker
- QR Code & Barcode Generator
- Regex Tester
- Slug Generator
- SQL Builder
- SQL Formatter
- Word Counter
- Text Translator
- Time Tools
- TS Formatter
- TS Minifier
- TSX Formatter
- TSX Minifier
- Unix Timestamp Converter
- UUID Generator
- YAML Formatter
- Case Converter