Utilities Batch Processing 2026-04-10

Batch UUID Generation

Generate thousands of UUIDs (v4, v7) for database seeding, test fixtures, and API integration using Bash, Python, and Node.js scripts.

Tools used: UUID Generator All Free

The Problem

You need hundreds or thousands of unique identifiers for database seeding, test data generation, or migrating from auto-increment IDs to UUIDs. Generating them one at a time and copy-pasting is impractical.

Why Batch Processing Matters

Batch UUID generation is essential for database seeding and fixtures (populating dev/staging environments), load testing (generating unique request IDs), data migration (assigning UUIDs to legacy records), and creating deterministic test datasets with reproducible IDs.

Common Use Cases

  • Seed a database with 10,000 test records, each needing a unique UUID primary key
  • Generate unique correlation IDs for load testing API endpoints
  • Migrate a database from auto-increment integer IDs to UUIDs
  • Create test fixtures with predetermined UUIDs for reproducible tests
  • Generate bulk API keys or session tokens for provisioning

Step-by-Step Instructions

1

Choose your UUID version

UUID v4 (random) is the most common — good for primary keys and general use. UUID v7 (time-ordered) is better for database indexes as it preserves insertion order. Use the UUID Generator to test formats.

2

Determine the quantity and format

Decide how many UUIDs you need and the output format: one per line (for SQL inserts), CSV column, or JSON array. Most scripts below output one UUID per line — pipe to jq or awk to reshape.

3

Run the generation script

Pick your preferred language from the examples below. All methods produce cryptographically random UUIDs suitable for production use.

4

Verify uniqueness

Sanity-check your output: sort uuids.txt | uniq -d should return nothing (no duplicates). For large batches, verify the count: wc -l uuids.txt.

Code Examples

# Generate 1000 UUID v4s (Linux — uses /proc/sys/kernel/random/uuid)
for i in $(seq 1000); do cat /proc/sys/kernel/random/uuid; done > uuids.txt

# macOS alternative using uuidgen
for i in $(seq 1000); do uuidgen | tr '[:upper:]' '[:lower:]'; done > uuids.txt

# Generate UUIDs as SQL INSERT values
echo "INSERT INTO users (id) VALUES" > seed.sql
for i in $(seq 100); do
  uuid=$(uuidgen | tr '[:upper:]' '[:lower:]')
  echo "  ('$uuid')$([ $i -lt 100 ] && echo ',' || echo ';')"
done >> seed.sql

# Generate CSV with UUID + sequential number
paste -d',' <(seq 1000) <(for i in $(seq 1000); do uuidgen | tr 'A-Z' 'a-z'; done) > data.csv

Single vs Batch Comparison

Single UUID (web tool)
Click Generate → copy 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
Batch output (CLI)
$ python batch_uuid.py
Generated 10000 UUIDs → uuids.txt
Generated seed.sql with 10000 records

$ head -5 uuids.txt
a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d
d4c3b2a1-6f5e-4b7a-9c8d-1e0f3a2b5c4d
7e8f9a0b-1c2d-4e3f-a4b5-c6d7e8f90a1b
b0a9c8d7-e6f5-4342-b1a0-9c8d7e6f5a4b
3f2e1d0c-b9a8-4768-c5d4-e3f2a1b09c8d

$ sort uuids.txt | uniq -d | wc -l
0  # no duplicates

Frequently Asked Questions

Are batch-generated UUID v4s guaranteed unique?

Practically yes. UUID v4 has 122 random bits, giving 5.3 × 10³⁶ possible values. The probability of a collision in 10 billion UUIDs is about 1 in 10¹⁸. For all practical purposes, they are unique without coordination.

Should I use UUID v4 or v7 for database primary keys?

Use UUID v7 if your database supports it. v7 UUIDs are time-ordered, which means B-tree indexes stay sequential and don't fragment. v4 UUIDs are fully random, causing index scatter and slower inserts at scale (millions+ rows).

How do I generate deterministic UUIDs for testing?

Use UUID v5 (SHA-1 based) with a fixed namespace: uuid.uuid5(uuid.NAMESPACE_DNS, 'test-user-1') always produces the same UUID. This makes test fixtures reproducible across environments.

Related Batch Guides

Try these tools interactively

Each tool runs in your browser with no signup required. Process single items instantly.

Related Workflow Guides