UUID v4 Generator — Free Online

UUID v4 Generator

Regenerate on this page and you get one random UUID version 4 value, such as 4ded5614-2a19-4e93-875b-3616fa9a230d. Version 4 uses 122 random bits and fixed version and variant bits. The value is made in your browser and is not sent to a server. The page reports only the action and the version name to analytics.

The batch section makes between 1 and 1,000 values per click. You can copy the list, or download it as a .txt file with one value per line by default.

How this tool generates v4

The generator calls v4() from the uuid npm package (version 11.1.1), in generateUUID in src/components/UuidGenerator/uuidStore.ts. With no options, the library does this:

  • In a browser that has crypto.randomUUID, it returns that call's result. That function is the platform's cryptographic random generator.
  • Otherwise it takes 16 bytes from crypto.getRandomValues, sets the version nibble to 4 and the variant bits to 10, and formats the result.

The page does not use Math.random. The store then lower-cases the value by default, or upper-cases it when you pick UPPERCASE. The page makes no check for duplicates. Within a batch the values are only as unique as the random source makes them.

Worked example

One value from a single Regenerate click:

4ded5614-2a19-4e93-875b-3616fa9a230d

Reading the fields:

  • The third group starts with 4, so the version is 4.
  • The fourth group starts with 9, which is 1001 in binary. The top two bits are 10, the RFC 4122 variant.
  • The other 122 bits came from the random source.

To check a value in code:

import uuid
u = uuid.UUID("4ded5614-2a19-4e93-875b-3616fa9a230d")
print(u.version, u.variant)
# 4 specified in RFC 4122

Gotchas

1. The case buttons make a new value. The UPPERCASE and lowercase buttons call the generator again. If you toggle after you copy a value, you lose the one you copied. Copy after you have set the case. A test run gave:

before toggle: 7adabb6d-60eb-40c3-ac7e-547fae3088b3
after toggle : 4949C46E-6D06-4533-97EB-122F2E775113

The two values are different, so the toggle is not just a display change.

2. Regenerate replaces the value. The page keeps one value at a time. There is no history, so a value you have not copied is gone after the next click.

3. Batches are not checked for duplicates. The batch loop does not compare values with each other. Duplicates are not expected from 122 random bits, but if your import rejects duplicates, check after you paste.

4. v4 values do not sort by time. Random values land in any position in an index. If the table benefits from time order, use v7 or ULID, which put a millisecond timestamp first.

FAQ

Where does the randomness come from?

From the browser. The library calls crypto.randomUUID when the browser has it, and crypto.getRandomValues otherwise. Neither depends on Math.random.

How many v4 values can I make at once?

The batch section takes a quantity from 1 to 1,000. Larger numbers need your own script, for example uuid.uuid4() in a loop.

Is a v4 UUID a secret?

No. A UUID is an identifier. For a secret token, use a token generator that returns a fixed number of bytes, and store it hashed if you must keep it server-side.

Does this tool make other versions?

Yes. The sidebar switches between v1, v3, v5, v7, GUID, ULID and the nil UUID on the same page.