UUID Generator

UUIDs generated—
Length (chars)—
Format—

How UUID Generator is calculated: UUID v4 = 32 random hex characters in groups of 8-4-4-4-12, with the version digit 4 and the variant digit 8, 9, a, or b. Randomness comes from crypto.getRandomValues when available, with a Math.random fallback.

What is a UUID generator?

A UUID — a universally unique identifier — is a 128-bit label that is practically guaranteed to be unique. It looks like this: a string of 32 hexadecimal characters, split by hyphens into groups of 8, 4, 4, 4, and 12, 36 characters in total. It is used to give things an identity — a database row, a file, a session, a device — without needing a central counter to hand out the numbers.

This tool generates UUID version 4, the random kind. Each one is made from 122 random bits, with 6 bits fixed: the version digit is always 4, marking it as a version 4 UUID, and the variant digit is always 8, 9, a, or b, marking the layout variant. Those fixed digits are how you can tell a v4 UUID from any other kind at a glance — look at the 13th character and it is a 4.

The uniqueness comes from the numbers involved. With 122 random bits, there are about 5 followed by 36 zeroes possible UUIDs. Generate a billion UUIDs a second for a hundred years and the chance of any two colliding is still vanishingly small — far smaller than the chance of being struck by lightning twice. That is why systems can generate UUIDs independently, on different machines, and still trust that they will never clash.

Click the Generate button and the tool makes as many as you asked for — up to 10 at a time — and shows them in the output box, one per line, ready to copy. Every click makes fresh ones. Nothing is stored, nothing is reused, and the same UUID will never come up twice.

How this UUID generator works

The generator asks the browser for 16 random bytes using crypto.getRandomValues, the same secure randomness the browser uses for its own cryptography. If that is unavailable — on a very old browser, for example — it falls back to Math.random, which is weaker but still works. The secure path is used whenever it exists, and it exists in every modern browser.

Once the 16 bytes exist, two of them are adjusted to carry the version and variant markers. The seventh byte has its top four bits set to 0100, which makes the 13th hex character a 4 — the version marker. The ninth byte has its top two bits set to 10, which makes the 17th hex character an 8, 9, a, or b — the variant marker. The other 122 bits stay exactly as random as they came.

The bytes are then written as hexadecimal and grouped: 8 characters, a hyphen, 4, a hyphen, 4, a hyphen, 4, a hyphen, and 12. That grouping is only a display convention — the value is the same with or without the hyphens, which is why the format selector offers a 32-character plain version too. Databases and APIs usually want the hyphens; compact storage sometimes wants them gone.

The count selector decides how many are made at once, from 1 to 10. Each one is generated independently from fresh random bytes, so a batch of 10 is ten unrelated identifiers, not ten variations on one. The results show the count, the length of each UUID in the chosen format, and the format name — UUID v4 — so you can confirm what you got before you copy it.

The numbers: length, count, and version

The three results describe the batch. UUIDs generated is the count you asked for — 1 by default, up to 10. Length is the character count of each UUID in the chosen format: 36 with hyphens, 32 without. Format is always UUID v4, because that is the only kind this tool makes, and the label is there so there is no doubt about which version you are getting.

The length difference is just the four hyphens. A UUID with hyphens is 32 hex characters plus 4 hyphens, which is 36. Without hyphens it is 32 hex characters and nothing else. Both forms name the same 128-bit value, and most systems accept either, but check what yours expects — a database column defined for 36 characters will reject a 32-character value if it is strict about length, and the reverse is also true.

The version digit is a useful check. Take any UUID this tool makes and look at the 13th character — the first character of the third group. It is always 4. Look at the 17th character — the first character of the fourth group — and it is always 8, 9, a, or b. If a UUID you are given does not follow that pattern, it is not a version 4 UUID, and it may have been made by a different method with different uniqueness guarantees.

The count matters when you generate in bulk. Ten UUIDs at once is convenient for seeding a test database or creating a set of keys, and the output box lists them one per line so they can be copied together or one at a time. Generate again and you get ten more, unrelated to the first ten — the tool never repeats a value it has already shown you.

A worked example: one UUID, then ten

Click Generate with the defaults — count 1, hyphens on — and you get a single UUID, 36 characters long. It will look something like 3f6a1c2e-9b4d-4f8a-a1c2-5e6f7a8b9c0d, though yours will be different, because every generation is random. Check the two markers: the 13th character is 4, and the 17th is one of 8, 9, a, or b.

Switch the format to plain and generate again. The UUID is now 32 characters with no hyphens — the same kind of value, just written without separators. The length result changes from 36 to 32, the count stays 1, and the format stays UUID v4. Copy it into a system that stores identifiers without hyphens, and it fits exactly.

Set the count to 5, keep the hyphens, and generate. The output box now has 5 lines, each a different UUID, and the count result reads 5. Each line is independent: no two share more than chance would allow, and the version and variant markers are correct on every one of them. That is the property that makes UUIDs safe to generate in batches.

Set the count to 10 and generate once more. Ten fresh UUIDs, ten lines, and the count reads 10. That is the maximum in one click, which keeps the output readable. If you need more than ten, click again — the next batch is unrelated to the last, and the tool will happily make as many as you ask for, ten at a time.

Who generates UUIDs, and why

Developers generate UUIDs as primary keys for database rows, because a UUID can be created on any machine without asking a central server for the next number. A mobile app offline in a tunnel can create records with UUIDs, and when it reconnects, none of them clash with records created elsewhere. A sequential counter cannot do that; a UUID can.

Testers generate UUIDs to seed test data. A test database needs realistic identifiers that do not collide with production data, and a batch of fresh UUIDs provides them instantly. The same applies to API testing, where each request needs a unique idempotency key so that a retried request is recognised as a repeat rather than a new order.

System administrators generate UUIDs for files, devices, and sessions. A file stored under its UUID cannot collide with another file of the same name, and a session identified by a UUID cannot be guessed by trying the next number in a sequence — because there is no sequence, only randomness.

Writers and content teams use UUIDs as stable identifiers for articles, assets, and exports. A slug can change when a title changes, but a UUID never changes, so links and references built on it stay valid. Generate one, attach it to the item, and it identifies that item forever, wherever it goes.

UUID generator vs sequential IDs

The honest difference is coordination. A sequential ID — 1, 2, 3 — needs a single counter that everyone agrees on, which means a central database or a lock. A UUID needs no coordination at all: any machine can make one, at any time, and it will not clash with one made anywhere else. That independence is the whole reason UUIDs exist.

The trade is size and readability. A sequential ID is short and tells you the order things were created. A UUID is 36 characters of hex that tells you nothing about order, and it takes more space in a database and in a URL. For a small table on one server, a counter is simpler. For anything distributed, offline, or merged from several sources, a UUID is safer.

There is also a security difference worth knowing. Sequential IDs are predictable: if your account is user 1042, user 1043 probably exists, and trying the next number is trivial. UUIDs are not predictable — guessing one is effectively impossible — so they do not leak how many users or orders exist, and they cannot be enumerated by counting up.

For the rest of the developer toolkit, the companions are close by: a random number generator makes plain random numbers when an identifier is overkill, a password generator makes secrets when the value must be both random and hard to guess, a word counter counts the words in a batch of generated values, and a JSON formatter formats the data that UUIDs usually identify.

Common UUID mistakes

The first mistake is using a UUID where a short code would do. A UUID is 36 characters of hex — fine for a database key, terrible for a code a human has to type, read over the phone, or remember. If people will see the identifier, use something shorter and designed for humans, and keep the UUID behind the scenes.

Second: assuming a UUID is secret. It is not. A UUID is an identifier, not a password, and anyone who sees it can use it wherever it is accepted as an identifier. If access to something depends on knowing its UUID alone, that access is only as secure as the UUID is hidden — which is to say, not secure at all. Use real authentication for access control.

Third: generating UUIDs with a weak random source. The version 4 guarantee depends on the randomness being genuinely unpredictable. This tool uses crypto.getRandomValues whenever it is available, which is the right source, and falls back to Math.random only where the secure source does not exist. If you generate UUIDs in your own code, use the secure source there too.

Fourth: mixing formats. Some systems store UUIDs with hyphens, others without, and a few in upper case. The value is the same, but a strict comparison of the text will say they differ. Pick one format for a system, convert at the boundary, and check the length — 36 with hyphens, 32 without — before you blame the data.

How to use this UUID generator

Choose how many UUIDs you want, from 1 to 10, and pick a format: with hyphens (36 characters) or without (32 characters). The defaults are 1 UUID with hyphens, which is the form most systems expect.

Click the Generate UUID button. Fresh UUIDs appear in the output box, one per line, and the results show the count, the length, and the format. Click again for a new batch — every click makes new ones, and no value is ever repeated.

Copy the UUIDs from the output box and paste them where you need them: a database seed, a test script, an API request, or a config file. Check the two markers before you use one — the 13th character is 4, and the 17th is 8, 9, a, or b — so you know you are holding a genuine version 4 UUID.

Everything runs in your browser. The UUIDs are generated on your device from your browser's secure randomness, and they are never uploaded, stored, or sent anywhere. Close the page and they are gone — keep a copy of any you need, because the tool cannot show you the same one twice. UUIDs are one kind of unique ID — for shorter, URL-friendly IDs, try our Nano ID generator, which makes 21-character IDs from a 64-symbol alphabet.

Frequently Asked Questions

A UUID version 4 is a 128-bit identifier made from random bits: 32 hex characters in groups of 8-4-4-4-12, 36 characters with hyphens. The 13th character is always 4, marking the version, and the 17th is always 8, 9, a, or b, marking the variant. With 122 random bits, collisions are so unlikely they can be ignored in practice.

From the browser's crypto.getRandomValues, the same secure randomness the browser uses for its own cryptography, whenever it is available — which is every modern browser. On a very old browser without it, the tool falls back to Math.random. The secure path is always preferred, because the uniqueness guarantee of a v4 UUID depends on the randomness being unpredictable.

Most systems expect hyphens: 36 characters, groups of 8-4-4-4-12. Some databases and compact formats store the 32-character plain form. Both name the same 128-bit value, so use whichever your system expects, and check the length — 36 with hyphens, 32 without — before you blame the data for a mismatch.

In practice, no. With 122 random bits there are about 5 followed by 36 zeroes possible UUIDs, and generating a billion a second for a hundred years would still leave the chance of a collision vanishingly small. That is why systems can generate UUIDs independently on different machines and trust they will never clash.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.