DevKits

UUID Generator

Generate random UUIDs (v4) and time-ordered UUIDs (v7) online. Bulk generate up to 1000 at once and copy with one click.

Last updated:

  • 67690a5d-87a7-4541-a8ad-bb1084f0f328
  • 9d46675e-e169-4f90-af0c-20695102c4be
  • 4d323976-9b6f-4516-a5ca-d3f850b98f25
  • 433eba73-6a25-4497-81c9-686aca9e21cd
  • ef1d461b-a12a-4965-b552-7fd44f8afa89

Click Generate to create a random UUID v4 or a time-ordered UUID v7. Bulk generate up to 1,000 at once — everything runs locally.

What is UUID Generator?

A UUID (Universally Unique Identifier), also called a GUID, is a 128-bit identifier that can be generated on any machine without coordination and be effectively guaranteed unique. UUIDs are the go-to primary key for distributed systems, event ids, upload names, and anything that needs a unique id without a central sequence.

How to generate UUIDs online

  1. 1Pick the UUID version: v4 (random) or v7 (time-ordered, RFC 9562).
  2. 2Choose how many UUIDs to generate (1 to 1000).
  3. 3Click Generate — the list appears instantly.
  4. 4Click Copy on any row to grab a single UUID, or Copy All to copy the whole list.

Use Cases

Database primary keys

Prefer UUID v7 over v4 as a primary key — v7 embeds a timestamp, so rows are inserted in order and B-tree indexes stay compact.

Idempotency keys

APIs like Stripe and Shopify use client-generated UUIDs as idempotency keys, so retries never charge twice.

File upload names

Rename user uploads to a UUID before saving — avoids collisions, path traversal, and information leakage from original filenames.

Correlation / trace IDs

Attach a UUID to a request at the edge and propagate it across microservices to stitch logs into a single trace.

Code Examples

UUID v4 in the browser (native)

// Modern browsers & Node 19+
const id = crypto.randomUUID();

UUID v7 in Node.js

// npm i uuid
import { v7 as uuidv7 } from "uuid";
const id = uuidv7();

UUID in Python

import uuid
print(uuid.uuid4())            # random
# uuid7 not in stdlib yet; use uuid7 package

UUID in Go

import "github.com/google/uuid"

id := uuid.New()               // v4
// For v7: github.com/gofrs/uuid/v5

UUID in SQL

-- PostgreSQL
SELECT gen_random_uuid();      -- v4
-- MySQL 8+
SELECT UUID();

Key Concepts

UUID v4
Fully random 128-bit id (122 bits of entropy). Collision probability is essentially zero even at billions of IDs.
UUID v7 (RFC 9562)
First 48 bits are a Unix millisecond timestamp, rest is random. Sortable by creation time — ideal as a database primary key.
ULID
A UUID-compatible 128-bit id with millisecond timestamp + randomness, but encoded in Crockford Base32 (26 chars, no dashes). UUID v7 largely obsoletes ULID.
NanoID
Shorter (21 chars) alternative for URLs, using a custom alphabet. Not a UUID and not sortable, but URL-friendly.

Tips & Best Practices

  • For new databases: prefer UUID v7 over v4. It's monotonic, indexes better, and reveals no more information than v4 does (still random after the timestamp).
  • Store UUIDs as `uuid` type (Postgres) or `BINARY(16)` (MySQL). Storing as `VARCHAR(36)` doubles storage and slows every index scan.
  • Never expose sequential integer IDs in URLs if enumeration is a risk. UUIDs are effectively unguessable.
  • For very high-write workloads, UUID v7 also helps avoid the 'random insert' write-amplification problem that plagues v4 primary keys.

Frequently Asked Questions

What is the difference between UUID v4 and v7?

UUID v4 is fully random. UUID v7 embeds a Unix millisecond timestamp in the first bits, making it time-ordered and much more efficient as a database primary key.

Are these UUIDs cryptographically secure?

Yes. The random bytes come from the browser's crypto.getRandomValues, which is a cryptographically secure pseudo-random number generator.

Related Tools