UUID Lab 🔢 — UUID v4/v7, Nanoid, Short ID & ULID Generator
Pricing
from $0.008 / actor start
UUID Lab 🔢 — UUID v4/v7, Nanoid, Short ID & ULID Generator
Pure-Python ID generator producing UUID v4, UUID v7 (time-ordered), nanoid (customizable length/alphabet), short base62 IDs, and Crockford Base32 ULIDs. Supports batch mode for generating multiple different ID types in a single run. Zero external dependencies.
Pricing
from $0.008 / actor start
Rating
0.0
(0)
Developer
Perry AY
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
9 hours ago
Last modified
Categories
Share
UUID Lab — Generate UUID v4, UUID v7, Nanoid, Short ID, ULID, and Base62 IDs
What does it do?
UUID Lab is a pure-Python ID generator that produces six types of universally unique identifiers — UUID v4 (random), UUID v7 (time-ordered), nanoid (customizable alphabet/length), short base62 IDs, Crockford Base32 ULIDs, and plain UUIDs — in batches of 1 to 100 at a time. Stop copy-pasting from online generators or writing throwaway scripts every time you need a batch of IDs for database seeding, URL shorteners, distributed tracing, or API key generation.
Who is it for?
| Persona | What they use it for |
|---|---|
| Backend Developer | Generating primary keys for database tables, API resource identifiers, and event stream IDs |
| DevOps Engineer | Producing unique IDs for deployment trace correlation, log correlation, and container instance labels |
| Data Scientist | Creating unique identifiers for experiment runs, dataset rows, model versions, and A/B test variants |
| Frontend Developer | Generating client-side IDs for optimistic UI updates, React list keys, and local storage records |
| System Architect | Evaluating different ID formats — UUID v7 sortability, ULID density, nanoid URL safety — for distributed system design |
| Security Engineer | Producing cryptographically random session tokens, API keys, and one-time use nonces |
| Product Manager | Creating human-readable coupon codes and invite links with nanoid's customizable alphabet |
Why use this?
- Six ID types in one tool — UUID v4, UUID v7 (time-sortable), nanoid (configurable alphabet and length), short base62 IDs, Crockford Base32 ULIDs, and raw hex UUIDs. Pick the right format for your use case without installing six separate packages.
- Batch generation up to 100 IDs per run — Need 50 database keys for a seed script or 100 session tokens for a load test? One run gives you all of them in a clean JSON array. No loops, no concatenation, no scripting.
- Customizable nanoids — Nanoids support a configurable alphabet (use only uppercase, only digits, hex-only, or your own custom set) and adjustable length (1–64). Perfect for URL shorteners, coupon codes, invite links, and human-friendly identifiers.
- Time-ordered UUID v7 — UUID v7 embeds a millisecond-precision Unix timestamp in the first 48 bits, making IDs sortable by creation time. Ideal for database indexes that need insert-order clustering without a separate
created_atcolumn. - Cryptographically secure randomness — UUID Lab uses Python's
secretsmodule andos.urandomunder the hood. Every ID is generated with a CSPRNG, suitable for security-sensitive use cases like API keys, session tokens, and authentication nonces. - Deterministic and reproducible — No external state, no network calls, no database queries. Every run produces consistent, spec-compliant IDs you can trust in production systems.
Input Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
mode | string | yes | uuid4 | ID type to generate. One of: uuid4, uuid7, nanoid, shortid, ulid, uuid |
count | integer | no | 1 | Number of IDs to generate. Range: 1–100 |
alphabet | string | no | 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_- | Custom character set for nanoid mode only. Ignored for all other modes. |
length | integer | no | 21 | Length of each generated ID in nanoid mode only. Ignored for all other modes. Range: 1–64 |
Mode reference
| Mode | ID Format | Example | Best For |
|---|---|---|---|
uuid4 | Random UUID (36 chars, 5 groups, hex) | f47ac10b-58cc-4372-a567-0e02b2c3d479 | General-purpose unique identifiers, database PKs |
uuid7 | Time-ordered UUID (36 chars) | 018f3a6b-7c8d-7345-b123-9abc0def1234 | Sortable primary keys, time-series data, event streams |
nanoid | Configurable alphabet and length | V1StGXR8_Z5jdHi6B-myT | URL shorteners, public IDs, coupon codes, invite links |
shortid | Base62 short ID (6–12 chars) | 3Kc8aV | Compact references, short URLs, tiny IDs |
ulid | Crockford Base32 ULID (26 chars) | 01ARZ3NDEKTSV4RRFFQ69G5FAV | Sortable IDs, distributed systems, Kafka keys |
uuid | Plain hex UUID (32 chars, no hyphens) | f47ac10b58cc4372a5670e02b2c3d479 | Systems that prefer compact hex without hyphens |
Example Input
{"mode": "nanoid","count": 10,"alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789","length": 8}
Other mode examples
{"mode": "uuid7","count": 5}
{"mode": "ulid","count": 20}
{"mode": "shortid","count": 1}
Output Structure
| Field | Type | Description |
|---|---|---|
mode | string | The ID generation mode that was used |
count | integer | Number of IDs generated |
ids | array of strings | The generated IDs in string format |
metadata | object | Additional information about the generated IDs (format description, length, and for uuid7: generation timestamp) |
Example Output
{"mode": "nanoid","count": 10,"ids": ["A3K8X9BZ","M7Q2R5VN","J9P4W1CL","E6Y0T8DF","H2N5S7GU","C1V9L3XI","F8M0B4WK","D7P6H2QE","K4R1Y9TS","Z3W5L8NO"],"metadata": {"format": "nanoid","alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789","length": 8,"collisionProbability": "negligible","generatedAt": "2026-07-19T12:00:00Z"}}
UUID v7 output example
{"mode": "uuid7","count": 3,"ids": ["018f3a6b-7c8d-7000-b123-9abc0def1234","018f3a6b-7c8d-7001-b123-9abc0def1235","018f3a6b-7c8d-7002-b123-9abc0def1236"],"metadata": {"format": "UUID v7 (time-ordered)","timestamp": "2026-07-19T12:00:00.123Z","length": 36,"sortable": true}}
API Usage
cURL
# Generate 5 UUID v7 IDscurl -X POST "https://api.apify.com/v2/acts/perryay~uuid-lab/runs" \-H "Content-Type: application/json" \-H "Authorization: Bearer YOUR_API_TOKEN" \-d '{"mode": "uuid7","count": 5}'# Generate 20 nanoids with hex-only alphabet (for coupon codes)curl -X POST "https://api.apify.com/v2/acts/perryay~uuid-lab/runs" \-H "Content-Type: application/json" \-H "Authorization: Bearer YOUR_API_TOKEN" \-d '{"mode": "nanoid","count": 20,"alphabet": "0123456789ABCDEF","length": 12}'# Generate a single ULIDcurl -X POST "https://api.apify.com/v2/acts/perryay~uuid-lab/runs" \-H "Content-Type: application/json" \-H "Authorization: Bearer YOUR_API_TOKEN" \-d '{"mode": "ulid","count": 1}'# Generate 100 short IDscurl -X POST "https://api.apify.com/v2/acts/perryay~uuid-lab/runs" \-H "Content-Type: application/json" \-H "Authorization: Bearer YOUR_API_TOKEN" \-d '{"mode": "shortid","count": 100}'
Python
import requestsAPI_TOKEN = "YOUR_API_TOKEN"ACTOR_URL = "https://api.apify.com/v2/acts/perryay~uuid-lab/runs"# Generate 10 short IDs for URL referencesresponse = requests.post(ACTOR_URL,headers={"Content-Type": "application/json","Authorization": f"Bearer {API_TOKEN}"},json={"mode": "shortid", "count": 10})result = response.json()for i, id_value in enumerate(result["ids"]):print(f"ID {i + 1}: {id_value}")# Generate human-friendly coupon codesresponse = requests.post(ACTOR_URL,headers={"Content-Type": "application/json","Authorization": f"Bearer {API_TOKEN}"},json={"mode": "nanoid","count": 50,"alphabet": "ABCDEFGHJKLMNPQRSTUVWXYZ23456789", # No I/1/O/0 ambiguity"length": 10})coupons = response.json()["ids"]print(f"Generated {len(coupons)} coupon codes")for code in coupons[:5]:print(f" SAVE-{code}") # e.g., SAVE-X7KP2RMT9A# Generate UUID v4 keys for database seedingresponse = requests.post(ACTOR_URL,headers={"Content-Type": "application/json","Authorization": f"Bearer {API_TOKEN}"},json={"mode": "uuid4", "count": 25})uuids = response.json()["ids"]with open("/tmp/seed_uuids.txt", "w") as f:for uid in uuids:f.write(f"{uid}\n")print(f"Wrote {len(uuids)} UUIDs to seed file")
Use Cases
-
Database Primary Key Generation — Seed your database tables with UUID v7 keys that sort chronologically. UUID v7's time-ordered structure means fewer B-tree page splits in PostgreSQL and MySQL compared to random UUID v4. Run a single batch to generate all the IDs you need for your seed script.
-
URL Shortener Tokens — Use nanoid mode with a URL-safe alphabet (
A-Za-z0-9_-) and length 8–10 to generate compact, collision-resistant tokens. At length 8 with the full 64-character alphabet, you get 64⁸ ≈ 2.8 × 10¹⁴ possible combinations — trillions of unique short URLs. -
Coupon & Promo Codes — Generate human-friendly coupon codes using nanoid with an uppercase-only alphabet that excludes ambiguous characters (I/1, O/0). Keep them short enough to type at checkout (8–12 characters) but long enough to resist brute-force guessing.
-
Distributed Tracing IDs — Use ULID or UUID v7 for distributed trace correlation IDs across microservices. The embedded timestamp lets you sort traces chronologically without parsing a separate timestamp field. The 26-character ULID format is more compact than standard UUIDs and sorts lexicographically.
-
API Key Generation — Batch-generate 100 cryptographically random API keys using shortid or nanoid with a long length (32+) and full alphabet. Export the list directly into your key management system, database seed file, or provisioning script.
-
Event Stream Partition Keys — Use time-ordered UUID v7 or ULID as partition keys for Kafka, Kinesis, or Pulsar event streams. Sortable IDs mean consumers can process events in chronological order without extracting timestamps, and the random suffix ensures even distribution across partitions.
-
Client-Side Optimistic IDs — Generate UUID v4 IDs on the client side before submitting data to the server. This enables optimistic UI updates — render the new record immediately with its known ID, then reconcile when the server responds. No need to wait for a server-generated ID.
FAQ
Q: What is the difference between UUID v4 and UUID v7? A: UUID v4 is fully random — all 122 bits are random with 6 version/variant bits. UUID v7 embeds a Unix millisecond timestamp in the first 48 bits, followed by version and random bits. Use v7 when you want your database primary keys to cluster chronologically (better index performance); use v4 when you want purely random IDs with no temporal correlation.
Q: Are the generated IDs cryptographically random?
A: Yes. UUID Lab uses Python's secrets module and os.urandom under the hood, which are cryptographically secure random number generators suitable for security-sensitive use cases like API keys, session tokens, authentication nonces, and password reset tokens.
Q: What is the collision probability for nanoid? A: With the default 64-character alphabet and length 21, the total ID space is 64²¹ ≈ 1.3 × 10³⁸ — far larger than the UUID 128-bit space. With a shorter length like 8, you get 64⁸ ≈ 2.8 × 10¹⁴ possibilities, which gives a 50% collision probability only after about 10⁷ IDs (birthday problem). For most non-security applications, this is more than sufficient.
Q: Can I generate ULIDs that are sortable like UUID v7? A: Yes. ULIDs (Crockford Base32, 26 characters) also embed a Unix millisecond timestamp in the first 10 characters (48 bits) and are lexicographically sortable. ULIDs are a popular alternative to UUID v7 in systems that prefer the more compact and URL-safe Base32 encoding.
Q: What does "shortid" mode produce? A: Short IDs are base62 encoded (0–9, a–z, A–Z) random values, typically 6–12 characters long depending on the entropy needed. Use them when you need compact, URL-safe identifiers that are easy to copy, share, and display in constrained UI spaces.
Q: How should I choose the right ID mode for my project?
A: Start with UUID v4 for general-purpose use. Switch to UUID v7 or ULID if you need sortable primary keys (time-series data, event logs, insert-ordered tables). Use nanoid with a custom alphabet for human-facing IDs (coupons, invite links). Use shortid when space is at a premium (URL shorteners, tiny URLs). Use plain uuid format when hyphens would break your storage or parsing logic.
Q: Can I generate IDs that look like YouTube or TikTok video IDs?
A: Yes — use nanoid mode with the default URL-safe alphabet (A-Za-z0-9_-) and length 11 for YouTube-style IDs, or length 8–10 for TikTok-style IDs. These are compact, URL-safe, and collision-resistant.
Q: Is there a limit on how many IDs I can generate per request?
A: The count parameter supports 1 to 100 at a time. For larger batches, make multiple requests. Since each request is stateless and takes milliseconds, you can generate thousands of IDs in seconds by iterating.
Related Tools
- JSON Studio — Format, validate, diff, and transform JSON documents
- QR Craft — Generate high-quality QR codes in PNG or SVG format
- Meta Mate — Extract Open Graph, Twitter Cards, and JSON-LD metadata from URLs
- Domain Intel — WHOIS lookups, DNS enumeration, and SSL certificate validation
Comparison: Which ID type should you choose?
| Use Case | Recommended Mode | Why |
|---|---|---|
| Database primary key (any) | uuid4 | Random, universally unique, no temporal correlation |
| Database primary key (time-series) | uuid7 or ulid | Time-ordered = better B-tree index performance |
| Public URL / shareable link | nanoid (length 8–11) | Compact, URL-safe, configurable alphabet |
| Coupon / promo code | nanoid (uppercase, no ambiguous chars) | Human-friendly, easy to type, collision-resistant |
| API key / secret token | nanoid (length 32+, full alphabet) | High entropy, cryptographically random |
| Distributed tracing | ulid or uuid7 | Sortable, compact, embeds timestamp |
| Short URL token | shortid | Minimum characters, base62 encoding |
| Hex-only storage (no hyphens) | uuid | Clean 32-char hex, database-friendly |
SEO Keywords
UUID generator, UUID v4, UUID v7, ULID generator, nanoid generator, short ID generator, base62 ID, unique ID generator, batch UUID generation, time-ordered UUID, random ID generator, API key generator, distributed system IDs, database primary key generator, Crockford Base32, URL shortener ID, coupon code generator, cryptographically random ID, UUID batch, ID generation API