UUID / GUID Generator
Generate random Universally Unique Identifiers (UUIDs) instantly.
UUIDs coordinate identity without a central counter
A Universally Unique Identifier is a 128-bit value with standardized textual and binary layouts. GUID is the name commonly used in Microsoft ecosystems; in everyday application work, UUID and GUID usually refer to compatible identifier text such as 550e8400-e29b-41d4-a716-446655440000. The canonical form contains 32 hexadecimal digits grouped 8-4-4-4-12, for 36 characters including hyphens.
This page is a UUID v4 generator. Set Number of UUIDs from 1 through the component’s stated maximum of 1000, and a list is produced immediately. Changing count regenerates the whole list. Regenerate makes another batch without changing the count. Clicking a row copies one identifier; Copy All writes newline-separated identifiers.
There is an important implementation caveat: this component fills version 4 fields with JavaScript Math.random(). It sets the version nibble to 4 and the RFC variant bits correctly, but Math.random() is not a cryptographically secure source and does not provide production-grade UUID v4 randomness. Use these values for mock data, screenshots, local fixtures, and interface testing. For production database keys, security-sensitive identifiers, idempotency keys, or distributed systems, use crypto.randomUUID(), a trusted UUID library backed by an operating-system CSPRNG, or your platform’s secure UUID facility.
Read the bits in a version 4 value
The hyphens are presentation, not separate data. In this example:
f47ac10b-58cc-4372-a567-0e02b2c3d479
the first hexadecimal digit in the third group is 4, identifying version 4. The first digit in the fourth group is one of 8, 9, a, or b, representing the RFC variant’s high-bit pattern. Version and variant consume six fixed bits, leaving 122 variable bits in a properly generated UUID v4.
“Universally unique” is probabilistic, not a mathematical guarantee. With uniform independent 122-bit choices, collision risk follows the birthday bound and remains negligible at ordinary scales. No generator can promise that two random identifiers will never match. Systems should still enforce a unique database constraint and retry generation if an insertion collides.
The probability calculation assumes secure, unbiased, independent randomness. This demo’s Math.random() breaks that security assumption and may have state or predictability properties that vary by engine. Correct formatting alone does not make an identifier securely generated.
UUIDs are identifiers, not secrets
A UUID can be hard to guess when produced securely, but unguessability should not be its access-control role. URLs like /invoice/{uuid} still require authentication and authorization for the requested invoice. Logs, referrers, analytics, browser history, screenshots, and shared links can disclose identifiers. Treat bearer reset links, API keys, and session tokens as dedicated high-entropy secrets with expiration and lifecycle controls rather than merely UUID-shaped strings.
Likewise, UUID text is not a hash, encryption, or encoding of a record. Version 4 carries random bits and fixed metadata; it does not conceal an underlying numeric ID because none is embedded by the v4 process. Hashing a UUID does not create meaningful ownership or authorization.
Some UUID versions do encode or derive information. Version 1 uses time and node-related fields; versions 3 and 5 derive deterministic IDs from a namespace and name with MD5 and SHA-1 respectively; version 7 is time-ordered with random fields. Select a version for system behavior, not because one textual sample looks preferable.
Database design choices
Store UUIDs in a native UUID type when the database provides one. It validates syntax, uses 16 bytes rather than 36-character text, and supports appropriate operators. If a binary column is used, define byte order across languages. Microsoft GUID APIs and some database functions historically expose mixed-endian field conventions, which can make the same bytes print differently.
Random v4 primary keys distribute inserts across an index. That supports decentralized creation but can increase page splits, cache misses, and storage compared with increasing keys. UUIDv7 or another reviewed time-sortable identifier can improve index locality while retaining distributed generation, but chronological prefixes disclose rough creation ordering and require correct library support.
Do not remove database uniqueness because collision probability is low. A unique index is also protection against generator bugs, accidental reuse, bad migrations, and duplicated fixtures. Handle conflict atomically by generating another identifier and retrying only the failed insert. A prior “does this ID exist?” query has a race and cannot replace the constraint.
Normalize representation at boundaries. UUID hex is case-insensitive, but string comparison, routing, caches, and signatures may not be. Prefer lowercase canonical text with hyphens unless an external protocol says otherwise. Validate the exact accepted forms rather than removing every non-hex character and hoping the remainder is valid.
Use a generated batch as test data
Choose a count that matches the fixture, copy all rows, and split on line feeds. Keep fixture IDs stable when snapshots, foreign keys, or reproducibility matter; regenerating on each test makes failures difficult to reproduce. Random values are useful for tests of uniqueness and parallel creation, but deterministic fixtures are better for expected-output assertions.
Add structural checks:
^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
That JavaScript-compatible pattern validates canonical lowercase UUID v4 shape, not randomness or uniqueness. With case-insensitive matching it also accepts uppercase. Prefer a UUID parser in application code because parsing conveys intent and may expose version and variant without maintaining a regex.
For an end-to-end persistence test, generate IDs through the same secure production library, insert parent and child records, retrieve them through API paths, serialize them to JSON, and verify round trips preserve value. Include uppercase input if accepted, missing hyphens if rejected, the nil UUID 00000000-0000-0000-0000-000000000000, a non-v4 UUID, malformed variant bits, and duplicates. Test authorization separately; knowing another fixture ID must not grant access.
Integration pitfalls
JavaScript should keep UUIDs as strings. Converting 128 bits to a Number loses precision. JSON naturally carries UUID text; binary protocols may have a dedicated 16-byte type. Ensure message schemas specify whether fields contain canonical strings or raw bytes.
A UUID database column should not be confused with an auto-increment sequence. Random IDs do not provide creation order, total count, or gap-free numbering. Sorting v4 strings produces arbitrary lexical order. Store an explicit timestamp and apply a deterministic tiebreaker when pagination needs stable chronology.
Do not generate identifiers in React render paths or repeatedly during retries without preserving the chosen value. If an HTTP client generates a new order ID on every retry, the server may create duplicate orders. Generate once for the logical operation, retain it, and use a separate idempotency policy where required.
Bulk creation should validate Number of UUIDs at the application boundary. This UI caps its numeric input, but a production endpoint must enforce limits server-side. Avoid logging enormous batches or accepting client identifiers as trusted ownership fields.
Common misconceptions
- A valid v4 pattern proves only format bits, not that randomness came from a CSPRNG.
- A UUID is not encrypted personally identifiable information.
- Collision resistance does not remove the need for a unique constraint.
- A GUID’s visual case does not change its 128-bit value.
- Random UUID ordering is not chronological ordering.
- Hashing a short predictable value into UUID shape does not make it random.
- The nil UUID is a sentinel, not a generated v4 identifier.
FAQ
How many UUID v4 values can I generate before a collision?
There is no fixed collision point. Probability rises with the square of the number generated under the birthday bound. Secure 122-bit randomness gives ample space, but production systems must still enforce uniqueness.
Are UUID and GUID the same?
They commonly refer to the same 128-bit identifier family and canonical text. Check binary byte-order conventions when exchanging raw bytes with Microsoft-specific APIs.
Can I use a UUID as an API key?
Use a purpose-built random token with documented entropy, secure generation, hashing or encryption at rest as appropriate, rotation, and scope. An identifier should remain an identifier.
Why does the list change when I edit the count?
The component regenerates the entire array whenever count changes. Preserve copied fixtures before adjusting it.
Is this online UUID generator suitable for production IDs?
Not in its current implementation because it uses Math.random(). Use crypto.randomUUID() or a maintained CSPRNG-backed library in the production runtime.