Browser JavaScript
const id = crypto.randomUUID();Generated privately on this device. Advanced format and batch controls are below.
Enter a whole number from 1 to 10,000.
Case, hyphens, braces, URN, quotes, prefix, and suffix change each displayed and exported value. JSON always uses valid JSON string quoting. A prefix or suffix wraps the identifier, so the result is no longer a canonical UUID.
Press Ctrl/Cmd + Enter to regenerate with the current settings. Large output is kept in this scrollable field for responsive rendering.
Paste a canonical, braced, compact, or urn:uuid: value. Wrapping prefixes or suffixes are not part of a UUID and are not accepted.
Validation runs locally as you type.
A UUID is a 128-bit identifier. Under RFC 9562 §5.4, UUID v4 contains 122 random bits: random_a, random_b, and random_c. The remaining six bits identify version 4 and the RFC UUID variant. RFC 9562 superseded RFC 4122.
The canonical pattern is xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx, where N is 8, 9, a, or b. The hyphens are display separators, not old-style time, clock, or node data. UUID v4 embeds neither a timestamp nor a MAC address.
This page feature-detects crypto.randomUUID() and validates its result. If unavailable, it uses crypto.getRandomValues(), then sets and validates the v4 version and variant bits. If neither secure API is available, the tool shows an error and does not generate values. Nothing is uploaded.
Cryptographically strong randomness makes v4 useful for opaque distributed IDs, but a UUID should not automatically replace a purpose-built API key, password-reset token, session secret, or authorization credential. Adding a prefix or suffix creates a wrapped identifier rather than a canonical UUID.
Last reviewed: .
With 2122 possible random values, the birthday-bound approximation for small probabilities is p ≈ n(n−1) / (2 × 2122). Near 50%, use p ≈ 1 − exp(−n(n−1)/(2 × 2122)).
| UUIDs generated | Approximate collision probability |
|---|---|
| 1 million (106) | 9.4 × 10−26 |
| 1 billion (109) | 9.4 × 10−20 |
| 1 trillion (1012) | 9.4 × 10−14 |
| About 2.71 × 1018 | 50% |
At one million UUIDs per second, reaching the 50% threshold would take roughly 85,700 years. Actual collision risk also depends on a correctly implemented random source.
| Consideration | UUID v4 | UUID v7 |
|---|---|---|
| Core data | Random | Unix timestamp plus random data |
| Chronological sorting | No | Yes |
| Creation-time privacy | Does not reveal time | Reveals approximate creation time |
| Distributed generation | Excellent | Excellent with a correct implementation |
| B-tree index locality | Random inserts can fragment indexes | Time ordering usually improves locality |
Choose v4 for opaque distributed identifiers. In write-heavy databases, v7 can be preferable because chronologically ordered inserts reduce B-tree fragmentation. “GUID” is common Microsoft terminology, not a fundamentally different kind of identifier; in most modern contexts it refers to the same 128-bit UUID format.
const id = crypto.randomUUID();const { randomUUID } = require('node:crypto');
const id = randomUUID();import uuid
id = uuid.uuid4()import java.util.UUID;
UUID id = UUID.randomUUID();using System;
Guid id = Guid.NewGuid();import "github.com/google/uuid"
id := uuid.NewString()SELECT gen_random_uuid();MySQL: its built-in UUID() function does not guarantee UUID v4. Generate v4 in application code or use a carefully reviewed database-side implementation.
Yes in theory, but the 122 random bits make a collision extraordinarily unlikely. About 2.71 × 10¹⁸ generated UUID v4 values are needed for a 50% collision probability.
No. UUID v4 contains random data plus fixed version and variant bits; it does not encode a timestamp or MAC address.
GUID is common Microsoft terminology for this family of 128-bit identifiers. In most modern developer contexts, GUID and UUID refer to the same textual identifier format.
Yes, especially for opaque distributed IDs. Random v4 inserts can fragment B-tree indexes in write-heavy databases, so UUID v7 may offer better index locality.
Normalize an optional urn:uuid: prefix, braces, and compact form, then verify 32 hexadecimal digits. For UUID v4, the version nibble must be 4 and the variant nibble must be 8, 9, a, or b.
For the RFC 9562 UUID variant, the first character of the fourth group is 8, 9, a, or b (case-insensitive).
Yes. Generation and validation run locally in your browser using Web Crypto; values are not sent to this site.
Choose v7 when chronological sorting and database index locality matter. Choose v4 when you want a fully random, opaque identifier with no embedded creation time.