toolgarden.xyz
中文

UUID Generator

Free online UUID v1 / v4 / v7 and NanoID generator with batch output, case toggle and hyphen removal

Generator settings

Results

Click Generate to create UUIDs

About this tool

A UUID is a 128-bit identifier that avoids collisions by having an enormous value space rather than by coordinating with anyone. The practical payoff is that a client can mint its own primary key while completely offline, without asking a database, and several services can write concurrently without clashing. The cost is that it is far longer than an auto-increment integer and carries no ordering information.

The versions solve different problems. v4 is pure randomness and fits almost every case. v7 puts a millisecond timestamp in the high bits, so sorting the strings sorts by creation time; which matters a great deal to database indexes. v1 also carries time, but writes the MAC address into the identifier and therefore leaks information about the machine. NanoID is not a UUID at all: it trades a different alphabet for a shorter string, which is what you want in a URL.

Generation uses the browser's `crypto.getRandomValues()`; the operating system's cryptographically secure random source, not `Math.random()`. That distinction matters whenever an identifier is treated as something hard to guess.

How to use it

  1. Pick a version

    v4 for general identifiers, v7 for database keys that need time ordering, v1 only when an older system explicitly requires it, NanoID for short identifiers in URLs and share links.

  2. Set how many you need

    Generate a batch at once; useful for seeding test data or pre-allocating a block of identifiers.

  3. Match the target system's format

    Switch case, or strip the hyphens. Some database columns and older APIs accept only the 32-character unhyphenated form, so align it here.

  4. Copy and use

    Copy the results straight out. Generation is entirely local and never touches a server, so the same value is not handed to anyone else.

Input and output example

The four shapes side by side. Note how the leading section of v7 increases over time, so lexicographic order equals creation order.

Version
v4
v7
v1
NanoID
Example output
9f8e7d6c-5b4a-4938-a271-6f0e5d4c3b2a
019205c7-3e80-7b19-8f42-1a9c7d3e5b60
6ba7b810-9dad-11d1-80b4-00c04fd430c8
V1StGXR8_Z5jdHi6B-myT

Supported range and limits

v4
122 random bits. No time information, no ordering; right for most identifiers
v7
A 48-bit millisecond timestamp in the high bits, random below. String order equals time order
v1
Timestamp plus node identifier. Embeds the MAC address, so it leaks host information
NanoID
21 characters by default from a URL-safe alphabet; shorter than a UUID and safe in a link
Random source
The browser's `crypto.getRandomValues()`, backed by the OS cryptographic RNG
Output format
Case switching and hyphen removal, to match what the target system accepts

When you would use it

  • Minting the primary key on the client

    Offline-first applications have to create records with no network. With UUID keys the client assigns an id immediately, wires up local relationships, and syncs the batch later; no waiting on a server-side auto-increment.

  • Choosing a sortable identifier for a database key

    A fully random v4 used as a clustered index key scatters inserts across the index and causes frequent page splits. v7's high bits increase, so inserts land at the end of the index; that is essentially why v7 exists.

  • Seeding tests and integration data

    Generate a batch to populate fixtures or mock payloads. Because generation is local and the value space is vast, none of it will collide with anything in a real environment.

What to know before you start

  • A UUID is unique but not secret. It is made of random bits, has no check digit, and cannot be validated as authentic. Using one as a hard-to-enumerate URL identifier is reasonable; using one as an access credential; "knowing the id grants access"; is not, because it will end up in logs, Referer headers and browser history.
  • v1 writes the generating machine's MAC address into the identifier. Anyone holding that UUID can infer which host produced it and roughly when. Avoid it unless a legacy system specifically demands v1.
  • v7 exposes creation time by design; that is the price of being sortable. If the creation timestamp is itself sensitive; you would rather outsiders could not infer your growth rate; do not put v7 on a public interface.
  • Storing a UUID as a string in a database costs more than twice the space of 16 raw bytes, and enlarges the index with it. At scale, consider a binary column and convert to the string form only at the API boundary.

Related concepts

RFC 9562
The current UUID standard, superseding RFC 4122 and formally defining v6, v7 and v8. v7 was standardised in this revision.
Version and variant bits
The 13th hexadecimal character encodes the version (4 for v4, 7 for v7) and the 17th encodes the variant. That is why the same position in every v4 is always 4 rather than random.
Monotonicity
v7's key property: a later value sorts higher lexicographically. It lets a clustered database index append sequentially instead of suffering random-insert page splits.
NanoID
An alternative outside the UUID standard: 21 URL-safe characters by default, with collision odds comparable to UUID v4 but a shorter string.

Frequently asked questions

Which UUID versions are supported?
It generates UUID v1, v4 and v7 as well as NanoID, so you can pick time-ordered or fully random identifiers.
Can I generate many at once?
Yes. Bulk generation is supported, with options for case and hyphen removal, ready to use as database keys.
Are the generated UUIDs uploaded?
No. Every UUID is generated randomly in your browser and is never sent to a server or logged.
Could two generated UUIDs collide?
Not in practice. v4 carries 122 random bits; generate a billion per second for centuries and the chance of a single collision remains negligible. That is precisely why UUIDs need no central coordination to stay unique.
v4 or v7 for a database primary key?
v7 when you need time ordering, or when the key is a clustered index: its high bits increase, so inserts land at the end and avoid page splits. v4 when you do not need ordering and would rather not reveal creation times.
Can I use a UUID as an access token?
Not advisable. It has no expiry, cannot be revoked, carries no verifiable issuer, and leaks readily through URLs into logs and browser history. Use a JWT or a server-issued session token when you need a credential.