UUID / ULID Generator
UUID / ULID Generator
Generate UUIDs v1/v4 and ULIDs instantly — bulk generation, multiple formats.
UUID / ULID Generator Tool
122 random bits from crypto.getRandomValues(). Use for general IDs.
UUID v5 is deterministic — the same namespace + name always produces the same UUID (SHA-1 based). The name is hashed exactly as typed, as UTF-8. Quantity is ignored.
crypto.getRandomValues(). Nothing is sent to any server.
Reads the version, the variant and, for v1, v6, v7 and ULID, the embedded creation time (shown in UTC). Nothing you paste leaves the page.
How to Use the UUID / ULID Generator
Choose your ID format
Select UUID v4 for most applications, UUID v7 or ULID when you need IDs that sort by creation time, UUID v5 for deterministic namespace-based IDs, or NanoID for compact URLs and short references.
Set the quantity
Generate 1 to 100 IDs at once for bulk database seeding, test data generation, or API payload construction. The generator runs instantly regardless of count.
Apply format options
Enable uppercase, remove hyphens, or wrap each ID in quotes or braces for direct use in SQL INSERT statements, JSON arrays, or CSV seed files.
Copy or download
Hover over any line and click its Copy button to grab a single ID. Use Copy All to send the full list to your clipboard, or Download .txt to save it as a file for import into your database tooling.
UUIDs, ULIDs and Unique Identifiers in Modern Software
UUID vs ULID vs NanoID: Which Should You Use in 2026?
Choosing the right unique identifier format has a real impact on database performance, URL readability, and system scalability. Each format was designed to solve a specific problem, and understanding the trade-offs helps you make the right call from the start.
UUID v4 is the universal standard. At 36 characters (32 hex + 4 hyphens),
it is supported by every major database, framework, and programming language. RFC 9562 §5.4
lets an implementation either fill all 128 bits and overwrite the version and variant
afterwards, or generate the exact required number of bits for random_a, random_b, and
random_c (122 bits total)
. This page calls crypto.randomUUID() where the
browser has it and otherwise fills sixteen bytes from crypto.getRandomValues()
and sets those two fields by hand — both routes draw on the platform CSPRNG that RFC 9562
§6.9 asks for, and neither derives anything from Math.random().
Use UUID v4 when compatibility with existing tooling matters or when you are
building an API that external consumers will work with.
UUID v7 — standardised in RFC 9562 in 2024 — is the time-ordered format
to reach for today. Its layout is a 48-bit big-endian Unix timestamp in milliseconds,
then the 4-bit version and 2-bit variant fields, then random data for the remainder.
Because the timestamp sits in the most significant bits, v7 values sort by creation time
under a plain byte-by-byte comparison — no MAC address, no node field of any kind.
The timestamp alone cannot order IDs minted in the same millisecond, and a batch of a
hundred is minted in one. RFC 9562 §6.2 asks implementations to Take care to ensure
UUIDs generated in batches are also monotonic
, and this page uses its Method 2: the
12-bit rand_a and a starting value for the 62-bit rand_b are drawn
once per millisecond from crypto.getRandomValues(), and each further ID in that
millisecond adds a fresh random step of between 1 and 2³² to rand_b. The list
therefore sorts in the order it was generated, and later IDs still cannot be guessed from
the first. If the clock steps backwards, the previous millisecond is reused, which is the
RFC's own suggestion for keeping order.
UUID v1 is time-based but not time-sortable, and the
difference matters. Its leading field is time_low — the low 32 bits of a
60-bit counter of 100-nanosecond intervals — so the first eight characters wrap roughly
every 429.5 seconds and v1 values do not sort in creation order. RFC 9562 §2.1 makes the
point directly: ordering v1 by time requires introspection, "as opposed to being able to
perform a simple byte-by-byte comparison". Classic v1 also embeds the generating
machine's MAC address in its node field, which lets anyone holding a UUID work out which
host produced it. RFC 9562 §5.6 defines UUID v6 purely to reorder v1's fields for
database locality, and §5.7 is explicit for new work: "Implementations SHOULD utilize
UUIDv7 instead of UUIDv1 and UUIDv6 if possible." This generator emits the v1 layout with
a random, multicast-flagged node in place of a MAC address, so it leaks no hardware
identity — but choose v7 when you actually want sortable IDs.
ULID (Universally Unique Lexicographically Sortable Identifier) uses 26
Crockford Base32 characters — time-sortable, URL-safe, case-insensitive. The first 10
characters encode 48-bit millisecond precision; the remaining 16 characters are 80-bit
random. Like UUID v7, ULIDs sort naturally by creation time without a separate timestamp
column, so a store whose write performance depends on keys arriving in order gets that
property with no coordinating sequence. Note that ULID is not an IETF standard and carries
no version or variant field: a ULID is not a UUID, and a column typed uuid
will not take one. Within one millisecond this page follows the ULID specification's
monotonic rule: the
. That keeps a batch in order, and it also means
every ULID after the first in a millisecond is predictable from the one before it.
random component is incremented by 1 bit in the least
significant bit position (with carrying)
UUID v5 is the odd one out here because it contains no randomness at all.
RFC 9562 §5.5 defines it as the SHA-1 hash of a namespace UUID concatenated with a name,
truncated to 128 bits, with the version and variant fields then overwritten — so the same
namespace and the same name always yield the same UUID, on any machine, for ever. That is
the point of it: a stable identifier for something that already has a natural key. The RFC
also draws the boundary — where SHA-1 is unavailable or considered unsafe, a name-based
UUID built on SHA-256 MUST NOT utilize UUIDv5 and MUST be within the UUIDv8 space
.
This page emits v5 only, using the browser's
crypto.subtle.digest('SHA-1', …).
NanoID produces 21 URL-safe characters using a 64-character alphabet (A-Za-z0-9_-), achieving comparable collision resistance to UUID v4 with 41.7% fewer characters (21 against a UUID string's 36). The compact format is ideal for URL slugs, short-link systems, and API resource identifiers where brevity matters.
"Generate one billion UUID v4s every second for 100 years and you reach roughly 3.16 × 10¹⁸ of them — about a 61% chance that two are identical. The 50/50 point arrives earlier, at 2.71 × 10¹⁸ UUIDs, or just over 86 years at that rate."
Why UUIDs Beat Auto-Increment IDs in Distributed Systems
Auto-increment integer IDs require a centralised counter — a single point of failure and a write bottleneck. In a single-database, single-server architecture this is fine, but as soon as you add a read replica, a second application server, or begin sharding your data, the centralised counter becomes a coordination problem. Every INSERT must contact the master database to obtain the next ID, creating latency and limiting write throughput.
UUIDs and ULIDs can be generated independently on any server, any microservice, or even in the browser itself — with zero coordination required. An order ID can be assigned by the client application before the record is written to any database. This is especially important for event-sourced systems, CQRS architectures, and multi-region deployments where network round trips are expensive.
The trade-off is database index locality. Random UUIDs (v4) scatter insertions across a
B-tree instead of appending at its right edge: leaf pages fill, then split, and the index
fragments — the page-fill-and-split behaviour PostgreSQL's fillfactor
documentation describes for random insertion patterns. RFC 9562 §2.1 lists
"poor database-index locality" among the problems with random UUIDs and notes that the
effects on B-tree indexes and their variants can be dramatic. The fix is a time-ordered
identifier — UUID v7 or ULID — whose values append in time order, preserving the
sequential-insert behaviour of auto-increment keys while keeping fully decentralised
generation.
MySQL has no UUID column type at all — CREATE TABLE t (id UUID) is a syntax
error. You pick the representation yourself: CHAR(36) or
VARCHAR(36) to keep the readable hyphenated text, or BINARY(16)
to store the 128 bits directly, converting with UUID_TO_BIN() and
BIN_TO_UUID(). PostgreSQL does have a native
uuid type, stored as 128 bits internally and declared simply as
UUID in a CREATE TABLE statement.
How UUID v4 Randomness Actually Works
UUID v4 derives its 122 bits of randomness from the platform's cryptographically secure
pseudorandom number generator. RFC 9562 §6.9 is the requirement: implementations
SHOULD utilize a cryptographically secure pseudorandom number generator (CSPRNG) to
provide values that are both difficult to predict ("unguessable") and have a low likelihood
of collision ("unique")
. In a browser that generator is reached through the Web
Cryptography API, whose note on random-value generation says implementations
should generate cryptographically strong random values using well-established
cryptographic pseudo-random number generators seeded with high-quality entropy, such as
from an operating-system entropy source
. Math.random() carries no such requirement: ECMA-262 asks
only for values chosen randomly or pseudo randomly with approximately uniform
distribution over that range, using an implementation-defined algorithm or strategy
,
and promises nothing about unpredictability. A UUID built from it is not a v4 in any sense
that matters.
The version (4) and variant (0b10) bits consume 6 of the 128 available bits, leaving 122 bits of effective randomness — 2¹²² ≈ 5.32 × 10³⁶ distinct values. Collision probability follows the birthday bound, P ≈ 1 − e−n² / (2 × 2¹²²), where n is the number of IDs generated. One billion IDs per second for one hundred years gives n ≈ 3.16 × 10¹⁸, which puts P at about 61% — so the even-odds point arrives a little earlier, at n ≈ 2.71 × 10¹⁸, or just over 86 years at that rate. Both figures describe a machine nobody is building; for any realistic application, UUID v4 collisions are not a practical concern.
The Crockford Base32 alphabet used in ULIDs was deliberately designed to eliminate visually ambiguous characters: no I (which looks like 1), no L (which looks like 1), no O (which looks like 0), and no U (which looks like V in some fonts). This makes ULIDs safer to read aloud, transcribe by hand, or display in error messages — a real ergonomic consideration for support teams and audit logs.
Collision odds, version bits, and what the RFCs changed
A UUID v4 contains 122 bits of randomness — 4 of the other bits are the version field (0b0100) and 2 are the variant field (0b10), which RFC 9562 §4.1 now labels simply the variant specified in this document
after retiring RFC 4122's name for it.
Two given v4s match with probability 1 in 2¹²² ≈ 5.3×10³⁶. The figure that governs a real system is different and far smaller: by the birthday bound, a set of v4s reaches even odds of containing a duplicate at about 2.7×10¹⁸ values.
UUID stands for Universally Unique Identifier — first standardised in RFC 4122 in 2005, and re-standardised in RFC 9562 in 2024, which added versions 6, 7 and 8.
MySQL has no UUID column type — you choose the representation yourself: CHAR(36)/VARCHAR(36) text, or BINARY(16) via UUID_TO_BIN() and BIN_TO_UUID().
Classic UUID v1 embeds the generating machine's MAC address in its node field; RFC 9562 §8 holds that MAC addresses pose inherent security risks around privacy and SHOULD NOT be used within a UUID
. This page follows §6.10 instead — a random 48-bit node with the multicast bit forced to 1, a bit that will never be set in IEEE 802 addresses obtained from network cards
.
Two UUIDs are reserved as sentinels: the Nil UUID (all 128 bits zero, 00000000-0000-0000-0000-000000000000) and the Max UUID (all bits one, ffffffff-ffff-ffff-ffff-ffffffffffff) — the Max form was only formally defined in RFC 9562 §5.10 in 2024.
The lineage is in RFC 9562's own abstract: UUIDs were originally used in the Apollo Network Computing System (NCS), later in the Open Software Foundation's (OSF's) Distributed Computing Environment (DCE), and then in Microsoft Windows platforms
— which is why GUID and UUID name the same 128 bits.
Frequently Asked Questions
-
A UUID (Universally Unique Identifier) is a 128-bit label used to uniquely identify information in computer systems. UUIDs are used as primary keys in databases, resource identifiers in APIs, transaction IDs, file names, and anywhere a unique identifier needs to be generated without central coordination. UUID v4 is the most common form — it uses 122 bits of cryptographic randomness to ensure uniqueness across all systems without any coordination between generators.
-
UUID v1 is time-based — it embeds a 60-bit timestamp plus the generating machine's MAC address — but it is not time-sortable. Its leading field is
time_low, the low 32 bits of the timestamp, which wraps roughly every 429.5 seconds, so sorting v1 values as strings or bytes does not give creation order. RFC 9562 §2.1 puts it in terms of needing introspection "as opposed to being able to perform a simple byte-by-byte comparison". The embedded MAC address also exposes which host generated each UUID — this page emits none, using the random multicast-flagged node of RFC 9562 §6.10 instead. UUID v4 is pure cryptographic randomness with no timestamp or machine information, making it privacy-safe but equally unsortable. For new applications RFC 9562 §5.7 recommends UUID v7 — a 48-bit Unix millisecond timestamp in the most significant bits, so it genuinely sorts by creation time — or ULID. -
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 26-character Crockford Base32 string that encodes a 48-bit millisecond timestamp in the first 10 characters and 80-bit random data in the remaining 16. Use ULID when you need IDs that sort chronologically by creation time without a separate timestamp column. ULIDs are also URL-safe and case-insensitive. ULID is not an IETF standard and has no version or variant field, so a ULID is not a UUID: its 26-character text form has to be converted before a column typed
uuidwill accept it. -
Theoretically yes, but the probability is astronomically low. UUID v4 has 122 bits of randomness — the collision probability formula gives approximately 50% chance of collision only after generating 2.71 × 10¹⁸ UUIDs. At one billion UUIDs per second, that would take just over 86 years. No real application will ever generate enough UUIDs to make collision a practical concern. For truly collision-critical systems, you can add a unique database constraint as a safety net; at realistic volumes it is not expected to fire.
-
NanoID is a 21-character URL-safe random identifier using a 64-character alphabet (A-Za-z0-9_-). Twenty-one characters from a 64-symbol alphabet carry 126 bits, so it is marginally more random than UUID v4's 122 while using 41.7% fewer characters — 21 against a UUID string's 36 — making it ideal for URLs, API slugs, and short-link systems where compactness matters. Unlike UUID v4, NanoID has no hyphens, no fixed version/variant bits, and is safe to use directly in URLs without encoding. The trade-off is that NanoID is not an established standard — some systems require UUID format specifically.
-
MySQL has no UUID column type, so the choice is yours. The compact option is
BINARY(16)— the raw 128 bits — rather than the 36-characterCHAR(36)/VARCHAR(36)text form. Convert with MySQL's built-inUUID_TO_BIN()on the way in andBIN_TO_UUID()on the way out. The optional second argument,UUID_TO_BIN(uuid, 1), swaps the time-low and time-high fields to improve index locality for v1 UUIDs; MySQL's manual notes that this swapping provides no benefit for values that are not time-based v1 UUIDs, so leave it off for v4 and v7. -
Yes, with one deployment caveat.
crypto.randomUUID()is a Web Cryptography API method; it returns a version 4 UUID as defined by RFC 9562 §5.4, drawn from the same CSPRNG that backsgetRandomValues(). The caveat is that its IDL declaration is marked[SecureContext], so it exists only on an HTTPS page or localhost — so on a plain-HTTP origin the method is absent rather than broken. This page uses it where it exists and otherwise fills sixteen bytes fromcrypto.getRandomValues()and writes the version and variant fields itself, which produces the same thing. What neither route gives you is unpredictability you can lean on for authorisation: RFC 9562 §8 states that implementationsSHOULD NOT assume that UUIDs are hard to guess
and that theyMUST NOT be used as security capabilities (identifiers whose mere possession grants access)
. -
Version 4 is everywhere, and version 7 has been arriving in standard libraries. Python:
uuid.uuid4(), anduuid.uuid7()from Python 3.14, which uses a 42-bit counter for order within a millisecond. Node.js:crypto.randomUUID()(added in v15.6.0 and v14.17.0) andcrypto.randomUUIDv7()(added in v26.1.0). Java:UUID.randomUUID(), documented as using a cryptographically strong generator. Go, with thegithub.com/google/uuidpackage:uuid.New()for v4 anduuid.NewV7()for v7. Laravel:Str::uuid()for v4 andStr::uuid7()for v7. PostgreSQL: see the next question. -
gen_random_uuid(), a version 4 UUID, is in core from PostgreSQL 13 and needs no extension. PostgreSQL 18 addsuuidv4()as another name for it anduuidv7()for time-ordered IDs; the 18 manual says its v7 timestamp iscomputed using UNIX timestamp with millisecond precision + sub-millisecond timestamp + random
. Theuuid-osspmodule adds the other standard algorithms. PostgreSQL stores UUIDs in a native 128-bit type declared simply asUUIDin CREATE TABLE — unlike MySQL, which has no UUID type and leaves the representation to you.
Related News
You may be interested in these recent stories from our newsroom.
-
DeepSeek Planned to Answer V4 Pro Calls With a Different Model. Then It Backed Down.
The redirect to V4.1 Flash was due at noon on 14 September. DeepSeek now says V4 Pro stays, at the same price. A better model behind the sam...
-
Cloudflare Built A Browser That Throws Away Everything Humans Need
Kitesurf runs in V8 isolates on Workers with no Chromium underneath, claims 3 to 7 times less CPU and memory for agent tasks, and passes ove...
-
Three Cents Per Thousand Images Changes What You Can Build
DeepMind priced Nano Banana 2 Lite at US$0.034 per 1,000 images and Gemini Omni Flash at US$0.10 per second of video. One of those numbers r...
Method & sources
How it computes
UUID v1, v4, v5 and v7 to RFC 9562 (pinned to its Appendix A vectors), ULID and NanoID. Random fields from crypto.getRandomValues() (v4 via crypto.randomUUID() where present); v5 = SHA-1 via crypto.subtle. Batches keep creation order: v7 by §6.2 Method 2 (random 1..2^32 steps in rand_b), ULID by the spec's +1 rule. An inspector reads version, variant and embedded time (UTC).
What this tool implements
- Layouts follow RFC 9562 and are pinned to its Appendix A test vectors: A.1 (v1), A.3 (v4), A.4 (v5, SHA-1 of the DNS namespace and "www.example.com"), A.5 (v6, inspection only) and A.6 (v7). The four namespace IDs offered for v5 are the §6.6 registered values; a custom namespace must itself be a UUID.
- Batch monotonicity (RFC 9562 §6.2, "Take care to ensure UUIDs generated in batches are also monotonic"): v7 uses Method 2 — rand_a and a seed for rand_b drawn once per millisecond, the seed's top bit cleared as a rollover guard, each further ID adding a random step of 1 to 2^32. A clock stepping back reuses the previous millisecond; an exhausted counter moves the timestamp ahead by 1 ms (the §6.2 MAY branch). Until 2026-11-05 a batch of 100 v7s came out in random order.
- ULID follows the ulid/spec layout (48-bit Unix ms, 80 random bits, Crockford Base32, maximum 7ZZZZZZZZZZZZZZZZZZZZZZZZZ) and its monotonic rule: in the same millisecond the random component is incremented by 1 with carry, which the page states makes later IDs in a batch predictable.
- v1 is emitted MAC-free: the node is 48 random bits with the multicast bit set (§6.10), and the page says v1 does not sort by creation time and recommends v7 (§5.7).
- Format options apply only where they cannot change the identifier: Uppercase and No hyphens are disabled for NanoID (case-sensitive alphabet that contains "-"), and braces for ULID and NanoID. Until 2026-11-05 both options rewrote NanoIDs.
- The inspector accepts any UUID (with or without hyphens, braces or urn:uuid:) and any ULID, and reports the §4.1 variant, the §4.2 version, Nil and Max (§5.9, §5.10), and for v1, v6, v7 and ULID the embedded time as UTC. It does not claim anything about a NanoID beyond its shape.
Show 1 more
- RFC 9562 §8 is quoted: UUIDs "MUST NOT be used as security capabilities". The FAQ no longer lists session tokens as a UUID use.
Sources
- RFC 9562, Universally Unique IDentifiers (UUIDs), IETF, May 2024 — §4.1 variant (Table 1), §4.2 version, §5.1 v1, §5.4 v4, §5.5 v5, §5.6 v6, §5.7 v7, §5.9 Nil, §5.10 Max, §6.2 monotonicity and counters, §6.6 namespace IDs, §6.10 random node, §8 security, Appendix A test vectors: https://www.rfc-editor.org/rfc/rfc9562
- ULID specification, ulid/spec — components, Crockford Base32 alphabet, monotonicity, overflow bound: https://github.com/ulid/spec
- ulid/javascript README — encodeTime(1469918176385) = "01ARYZ6S41", used as a test vector: https://github.com/ulid/javascript
- Nano ID, ai/nanoid README — the A-Za-z0-9_- alphabet and 21-symbol default size: https://github.com/ai/nanoid
- W3C Web Cryptography API — Crypto.getRandomValues() and the [SecureContext] randomUUID() and subtle: https://www.w3.org/TR/WebCryptoAPI/
- PostgreSQL 18 documentation, UUID Functions — gen_random_uuid(), uuidv4(), uuidv7(): https://www.postgresql.org/docs/18/functions-uuid.html; PostgreSQL 13 documentation, UUID Functions — gen_random_uuid() in core: https://www.postgresql.org/docs/13/functions-uuid.html
- MySQL 8.4 Reference Manual, Miscellaneous Functions — UUID_TO_BIN(), BIN_TO_UUID() and swap_flag: https://dev.mysql.com/doc/refman/8.4/en/miscellaneous-functions.html; Chapter 13 Data Types (no UUID type): https://dev.mysql.com/doc/refman/8.4/en/data-types.html
- Python 3 documentation, uuid — uuid4() and uuid7() (added in 3.14): https://docs.python.org/3/library/uuid.html; Node.js crypto — randomUUID() (v15.6.0, v14.17.0) and randomUUIDv7() (v26.1.0): https://nodejs.org/api/crypto.html
What can make this go out of date
- None at runtime. Every identifier is computed in the browser from the platform CSPRNG and the system clock; nothing is requested from or sent to a server, stored, or put in the URL.
- The time-based formats (v1, v7, ULID) read the client clock, so a machine with a wrong clock produces IDs that sort wrongly. No network time source is consulted.