UUID Generator for Database Primary Keys — Bulk v4, Free Online

Free UUID Generator — generate UUID v1, v4, and v5 identifiers online instantly

Instantly generate secure, RFC 4122 compliant Version 4 UUIDs (Universally Unique Identifiers) in bulk. Customize formatting, remove hyphens, or wrap in braces. Built for developers, database administrators, and QA engineers — 100% secure client-side generation with no server uploads.

Quick Answer

How do I generate a UUID v4 to use as a database primary key?

Click Generate above — you get an RFC 4122 compliant UUID v4 like '550e8400-e29b-41d4-a716-446655440000'. Copy it and use it directly in PostgreSQL (uuid type), MySQL (CHAR(36)), MongoDB (as _id), or any other database. Generate in bulk for seeding test data.

Developer Utility

Free UUID / GUID Generator

Instantly generate thousands of cryptographically secure Universally Unique Identifiers (v1 & v4). Customize formats and copy them directly to your clipboard.

Configuration
Generated Identifiers
0 Generated

When you actually need a UUID

The canonical use case is distributed systems: when two services need to independently generate IDs for objects that will later be merged, a sequential integer (1, 2, 3…) doesn't work — both services will generate the same numbers. A UUID is 128 bits of randomness that is statistically guaranteed to be unique across all systems and all time.

Common practical uses: primary keys for tables where you want to avoid exposing sequential IDs in URLs, idempotency keys for payment APIs, correlation IDs for log tracing, file upload names, and session identifiers. The recommendation in 2026: use crypto.randomUUID() natively in modern Node.js (v14.17+) and browsers — this is what the tool uses.

UUID versions and which to use

  • v4 (random)122 bits of random data. Most commonly used. What this tool generates. Use when you need uniqueness and don't care about sort order.
  • v7 (timestamp-ordered)Newer RFC standard that starts with a millisecond timestamp — UUIDs sort chronologically. Better for database primary keys as it avoids random index fragmentation. Node.js 22+ supports it natively.
  • v1 (timestamp + MAC address)Includes the device's MAC address — a privacy concern. Largely replaced by v4 and v7 for new applications.
  • v5 (SHA-1 namespace hash)Deterministic: same input always produces the same UUID. Useful for generating stable IDs from URLs or other strings.

Collision probability for v4: generating 1 billion UUIDs per second for 85 years gives a 50% chance of a single collision. For practical applications, collisions are not a real concern — the Earth has more atoms than there are possible v4 UUIDs is a common (if slightly overstated) illustration.

How to generate UUID v4 in code — JavaScript, Python, SQL, Go

For runtime UUID generation in your application, every major language has a built-in or standard-library option:

Language / DBCode snippet
JavaScript (Node 15+)crypto.randomUUID()
JavaScript (browser)crypto.randomUUID() // also works in browsers
Python 3import uuid; str(uuid.uuid4())
PostgreSQLSELECT gen_random_uuid(); -- or uuid_generate_v4() with pgcrypto
MySQL 8+SELECT UUID();
SQL ServerSELECT NEWID();
Goimport "github.com/google/uuid" uuid.New().String()
PHPRamsey\Uuid\Uuid::uuid4()->toString()
C# / .NETGuid.NewGuid().ToString()
JavaUUID.randomUUID().toString()
Rubyrequire 'securerandom'; SecureRandom.uuid

For test fixtures and seed data, use this generator to create a batch of UUIDs and paste them directly into SQL INSERT statements or JSON fixture files — faster than running a script for one-off needs.

TheFreeAITools — UUID/GUID Generator is a fully private, browser-based developer utility that creates RFC 4122 compliant Version 4 UUIDs in bulk. All processing runs locally on your device using the Web Crypto API — your identifiers never leave your computer. Supports generating one to 10,000 UUIDs per batch, with customizable formatting including uppercase, lowercase, braces, and hyphens. The fastest free way to create universally unique identifiers in 2026, with no installs, no accounts, and no hidden limits.

Video demo

☕ Support Us