UUID Generator
Generate random UUID v4 and v7 identifiers instantly. Bulk generation, uppercase, and no-dash options. Free, client-side, no signup.
Click Generate to create UUIDs
How to Use
- Select UUID v4 (random) or UUID v7 (time-sortable).
- Choose how many UUIDs to generate (1–50).
- Optionally enable Uppercase or No dashes formatting.
- Click Generate and copy the results.
What Is a UUID?
A UUID (Universally Unique Identifier), also known as a GUID (Globally Unique Identifier), is a 128-bit identifier represented as 32 hexadecimal digits displayed in five groups separated by hyphens: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. UUIDs are designed to be unique across space and time without requiring a central authority.
UUID v4 vs UUID v7
UUID v4 uses 122 bits of cryptographically secure random data. It's the most widely used version and is ideal when you need a unique identifier with no inherent meaning.
UUID v7 (defined in RFC 9562) embeds a millisecond-precision Unix timestamp in the first 48 bits, followed by random data. This makes v7 UUIDs naturally time-sortable — a significant advantage for database primary keys, as it maintains B-tree index locality and improves write performance.
Common Use Cases
- Database primary keys (especially UUID v7 for sorted insertion)
- Distributed system identifiers where coordination is impractical
- Session tokens and correlation IDs
- File naming to avoid conflicts
- API request tracing and logging
UUID Format Explained
A UUID is displayed as 32 hexadecimal digits in five groups separated by hyphens: 8-4-4-4-12. The version is indicated by the first digit of the third group — a 4 for v4, a 7 for v7. The variant is encoded in the first digit of the fourth group (typically 8, 9, a, or b for RFC 4122 UUIDs). The remaining digits are random data or timestamp-derived values.
UUID vs. Other Identifier Strategies
Auto-increment IDs (1, 2, 3...) are simple and efficient for single-database systems but fail in distributed environments where multiple servers need to generate IDs independently. They also leak information — a competitor can estimate your total user count by creating an account and reading their user ID.
UUIDs solve both problems: they can be generated anywhere without coordination, and they reveal nothing about creation order or volume (v4) or only the timestamp (v7). The tradeoff is size — a UUID uses 128 bits versus 32 or 64 bits for an integer, which increases index sizes in databases.
ULIDs (Universally Unique Lexicographically Sortable Identifiers) are an alternative that encodes a timestamp and random data in a 26-character Crockford Base32 string. They are time-sortable like UUID v7 but use a more compact text representation. Snowflake IDs (used by Twitter/X and Discord) pack a timestamp, worker ID, and sequence number into a 64-bit integer — efficient but require a central authority to assign worker IDs.
UUIDs in Databases
When using UUIDs as primary keys, UUID v7 is strongly recommended over v4. Random v4 UUIDs cause B-tree index fragmentation because new rows are inserted at random positions throughout the index. This leads to poor cache utilization and slower write performance. UUID v7's time-sorted property means new rows are always appended near the end of the index, similar to auto-increment behavior, while retaining the distributed generation benefits of UUIDs.
In PostgreSQL, store UUIDs as the native UUID type (16 bytes) rather than as text (36 bytes). MySQL 8.0+ also has a native UUID type. For older MySQL versions, use BINARY(16) with UUID_TO_BIN() and BIN_TO_UUID() functions.
Generating UUIDs in Code
In JavaScript, crypto.randomUUID() generates a v4 UUID natively in all modern browsers and Node.js 19+. In Python, use uuid.uuid4() from the standard library. In Go, the google/uuid package provides uuid.New(). For UUID v7 generation, libraries like uuid7 (Python) and uuidv7 (npm) are available while the standard libraries catch up.
Related Tools
Generate secure random strings with the Password Generator. Encode UUIDs for URLs with the Base64 Encoder or URL Encoder. Embed UUIDs in QR codes. Hash UUIDs for deduplication with the Hash Generator. Format UUID-containing JSON with the JSON Formatter. Convert timestamps to UUIDs v7 epoch with the Epoch Converter.
Frequently Asked Questions
- What is a UUID?
- A UUID (Universally Unique Identifier) is a 128-bit number used to uniquely identify information in computer systems. UUIDs are standardized by RFC 4122 and are commonly used as database primary keys, session tokens, and distributed system identifiers.
- What is the difference between UUID v4 and v7?
- UUID v4 is generated entirely from random numbers, making it completely unpredictable. UUID v7 embeds a Unix timestamp in the first 48 bits, making it time-sortable while still being unique. UUID v7 is preferred for database keys because it maintains insertion order and improves index performance.
- Are the generated UUIDs truly unique?
- Yes, for all practical purposes. UUID v4 uses 122 bits of randomness from your browser's cryptographic random number generator. The probability of generating a duplicate is astronomically small — you would need to generate 2.71 quintillion UUIDs to have a 50% chance of one collision.
- Is my data safe?
- Yes. All UUIDs are generated entirely in your browser using the Web Crypto API. No data is sent to any server.
- Can I use these UUIDs in production?
- Absolutely. The UUIDs are generated using crypto.randomUUID() and the Web Crypto API, which provide cryptographically secure random values suitable for production use.
Code Examples
Learn how to use this tool programmatically in your favorite language.
Use this tool from AI agents.
The CodeTidy MCP Server lets Claude, Cursor, and other AI agents
use this tool and 46 others directly. One command: npx @codetidy/mcp