Skip to main content
Develop Tools
← Return to usage guide

Generate UUIDv4 | Complete guide to usage, settings, and troubleshooting

If you need UUIDv4, do not implement it yourself with Math.random(); create it using the browser-standard crypto.randomUUID() or a Generator that uses a CSPRNG.

The process of generating UUIDv4 by setting Version 4 and the RFC Variant from cryptographically secure random values
The process of generating UUIDv4 by setting Version 4 and the RFC Variant from cryptographically secure random values

Generate and validate UUIDs in the browser

Generate UUIDv4 and v7 and check format, Version, Variant, duplicates, and v7 Timestamps without sending input externally.

Generate UUIDv4

Conclusion: Generate the 122-bit random portion with a CSPRNG, and fix the version and variant bits

UUIDv4 consists of Random or Pseudorandom Data in 122 of its 128 bits, excluding the Version and Variant. In browsers, crypto.randomUUID() returns a 36-character v4 UUID.

It is highly likely to be unique, but it is neither a centrally registered value nor mathematically impossible to collide. Add a unique constraint at the destination.

DevelopTools prioritizes randomUUID() and falls back to getRandomValues() when it is unsupported.

Check the version and variant of the generated result

In the standard notation xxxxxxxx-xxxx-4xxx-[89ab]xxx-xxxxxxxxxxxx, the first character of the third group is 4, and the first character of the fourth group is 8, 9, a, or b.

Uppercase and lowercase do not change bit values. The UUID value is the same even when adjusted to the destination style.

ItemHow to checkjudgment
Random sourceWeb Crypto APICSPRNG
VersionStart of the third group4
VariantStart of the fourth group8/9/a/b
DuplicationAfter generation and storage destinationUnique constraints

Procedure for checking with the UUID generation and validation tool

  1. Select v4 in Version.
  2. Choose the required count and display format.
  3. Generate it and check Version and Variant.
  4. Copy to the destination or save as a file.

Do not store UUIDs themselves in localStorage even when increasing the number generated.

Boundary between standard browser APIs and fallbacks

const id = crypto.randomUUID();
console.log(id); // Version 4 UUID

In the fallback, generate 16 bytes with getRandomValues(), set the high 4 bits of byte 6 to 0100, and set the high 2 bits of byte 8 to 10. Do not use Math.random() alone as the random source.

Check format, version, and variant separately

Account to checkLocation and conditionsWhat you understand
String notationxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx36 characters consisting of 32 hexadecimal digits and 4 hyphens
VersionThe leading nibble of the third group (bits 48–51)Layout identification such as v1–v8
VariantThe upper bit of the leading nibble in the fourth groupWhich rules to use to interpret the remaining fields
Meaning of the valueVersion-specific Fields, generation method, consumer constraintsValidity of time, namespace, random values, and similar data

The RFC 9562 standard text representation divides 128 bits into 8-4-4-4-12 Hex Groups. Uppercase, lowercase, and mixed-case alphabetic Hex are allowed. Even if the 36-character format is correct, it may not be the expected Version or suitable for the intended use, so check in stages.

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
              ^    ^
              |    +-- Nibble containing the Variant
              +------- Version Nibble

What DevelopTools' UUID generator and validator can do

ItemCurrent tool specification
GenerateGenerate 1 to 10,000 UUIDv4 / UUIDv7 values
InputAccept 8-4-4-4-12 format, 32-digit hexadecimal, braces, and urn:uuid: format.
verificationCheck format, version, variant, duplicates, Nil UUID, and Max UUID
UUIDv7Display the first 48 bits of Unix time (milliseconds) from an RFC Variant v7.
outputConvert to line breaks, commas, JSON, CSV, JavaScript arrays, or SQL IN clauses
SaveSave TXT / CSV / JSON locally with UTF-8 BOM
UnsupportedGeneration of UUIDv1, v3, v5, v6, and v8; generation of ULID / NanoID
Data retentionStore only settings such as Version, count, and display format in localStorage; do not store the UUIDs themselves

During validation, trim surrounding whitespace, remove URNs and curly braces, and normalize 32-digit hex to the standard format. Even if the format is correct, this does not guarantee that every version-specific field matches the purpose or that the issuer is trustworthy.

Prefer crypto.randomUUID() for UUIDv4; if it is unavailable, create 16 bytes with crypto.getRandomValues() and set the Version and Variant bits. UUIDv7 stores Date.now() Unix milliseconds in the first 48 bits and increments the random portion within the same millisecond to preserve the generation order on screen.

Do not confuse uniqueness, secrets, and privacy

PurposeScope handled by UUIDSeparately required measures
Record ID and Request IDGenerate identifiers in a distributed environment without coordination.Unique constraint and retry on conflict
API tokens and session secretsMay be used as an identifier for referencesSufficient entropy, authorization, expiration, and leak prevention
Tampering detectionA UUID alone does not detect changesSignature, MAC, authenticated message
Concealing timev7 can read a millisecond timestamp from the first 48 bitsConsider a design that does not expose time or version 4

UUIDs are not values that are mathematically guaranteed never to collide; they are identifiers designed to reduce collision probability through per-method random, time, Counter, and Namespace design. In a DB, add a Unique constraint to UUID columns and design for input conflicts and retries.

RFC 9562 requires that UUIDs not be treated as Security Capabilities that grant access merely by possession. Even a random UUIDv4 does not replace Password, API Key, Reset Token, or Session authentication design.

Privacy checks when handling data in the browser

  • Before pasting a production record ID or user ID, check whether the value itself is confidential.
  • The current tool does not send generated or validated UUIDs to external APIs
  • Copied content may remain in the OS or browser clipboard history
  • Display settings remain in localStorage, but generated values, verification values, and v7 timestamps are not saved
  • Use a dummy UUID instead of a production UUID in articles or issues for sharing

Browser processing avoids uploads, but it does not guarantee protection against device malware, malicious extensions, screen sharing, or clipboard monitoring. Handle highly confidential identifiers on trusted devices.

Check primary sources and the runtime environment

The current specification is based on RFC 9562, published in May 2024. RFC 9562 replaces RFC 4122. If names such as RFC_4122 remain in libraries, distinguish them as official API names retained for compatibility, and check the runtime version in use.

Example: create 100 UUIDs for API tests

Select v4, 100 items, and JSON format to generate them, then check Version 4 and the RFC Variant.

Save as a JSON array and assign it to test data. Keep the unique constraint in the destination database.

  1. Select v4
  2. Specify 100 items
  3. Generate JSON
  4. Check Version
  5. Save the generated results as JSON.

Use it as test data for identifiers, not as a substitute for production secrets.

Frequently asked questions

Are UUIDs guaranteed never to collide worldwide?
No. It is an identifier whose collision probability is made extremely small through an appropriate generation method. Also prepare a Unique constraint and collision handling on the consumer side.
Can a UUID be used as a Password or API Token?
Identifiers and Secrets have different roles. Do not grant Access based solely on possession of a UUID; use authentication, authorization, and revocation designs appropriate to the purpose.
Is the entered UUID sent to the Server?
The current UUID generation and validation tool processes in the Browser and does not send UUIDs to Servers or external APIs.