Developer tool · identifiers

UUID, ULID and Nano ID Generator

Generate identifiers in bulk with your browser's secure random generator, or paste one to read its version and embedded time. Version 7 follows RFC 9562 method 1: a 48-bit millisecond timestamp and a 12-bit counter that rises within the same millisecond.

Uses crypto.randomUUID when the browser has it, otherwise random bytes with the version and variant bits set.

Choose a type and press Generate.

UUID, ULID and Nano ID Generator

Operator: Abdulla Al Fahad. How tools are built and checked

Database keys, correlation IDs in logs, file names for uploads, idempotency keys on API calls: all of them need identifiers that two machines can create at the same moment without asking each other. This page produces the common kinds in bulk. UUID v4 for plain randomness, UUID v7 and ULID when you want IDs that sort by creation time, Nano ID when you want a shorter string with a custom alphabet, and the all-zero and all-one UUIDs when a test needs a placeholder.

There is also a decoder. Paste an ID from a log line or a table and it tells you the version and variant, and for the time-based kinds (v1, v6, v7 and ULID) the date and time embedded in it, which is handy when you are trying to work out when a record was really created.

Key features

  • UUID v4 using crypto.randomUUID, with a random-bytes fallback for older browsers
  • UUID v7 with a 12-bit counter that keeps IDs strictly increasing, including across millisecond boundaries
  • ULID and monotonic ULID in Crockford base32
  • Nano ID with configurable length and alphabet, drawn without modulo bias
  • Nil and max UUIDs
  • Lower or upper case, hyphens on or off, braces and urn:uuid: prefix
  • Bulk generation up to 1,000 with Copy all, .txt and .csv download
  • Decoder for version, variant and embedded time

How each ID format is built

UUIDs are 128 bits written as 32 hex digits in the groups 8-4-4-4-12. This tool can show them in lower or upper case, without hyphens, wrapped in braces (common in Windows registry and .NET contexts) or with the urn:uuid: prefix from RFC 9562. ULIDs are 26 characters of Crockford base32: ten characters for a 48-bit millisecond time, then sixteen for 80 random bits. Nano ID length and alphabet are yours to set; the default is 21 characters from 64 URL-safe symbols.

Version 7 is built as RFC 9562 describes: 48 bits of Unix time in milliseconds, then the version nibble, then 12 more bits, then the variant bits and 62 random bits. This page uses the 12 bits after the version as a counter (method 1 in the RFC). It starts at a random value below 2048 in each new millisecond and adds one per ID, so up to 2,048 IDs per millisecond stay in strict order. If a burst would overflow the counter, the timestamp is nudged forward one millisecond instead of ever repeating or going backwards. The monotonic ULID option works the same way in spirit: within a millisecond, the 80-bit random part is incremented by one.

Bulk runs are 1 to 1,000 values. The list shows the first 200 values; Copy all and the .txt and .csv downloads contain every one. The CSV has a single column named id, with each value quoted.

How it works

All randomness comes from crypto.getRandomValues or crypto.randomUUID. For Nano ID and the ULID random part, each character is picked with rejection sampling: raw 32-bit draws that would favour the first characters are discarded, so every alphabet character is equally likely.

For v7, the page reads the clock once per ID. If the new millisecond is later than the last one it used, the counter restarts at a random point; if it is the same or earlier (a clock stepped back, for example), it keeps the earlier timestamp and increases the counter. That is why a loop of 1,000 IDs created inside one millisecond still comes out in ascending order when compared as plain text.

The decoder removes an optional urn:uuid: prefix and braces, then checks for 32 hex digits with hyphens either in the 8-4-4-4-12 positions or absent. The version is the first digit of the third group; the variant comes from the top bits of the fourth group. For v1 and v6 it rebuilds the 60-bit count of 100-nanosecond steps since 15 October 1582 and converts it to a calendar time; for v7 it reads the first 48 bits as Unix milliseconds. A 26-character string is read as a ULID.

Typical uses

  • Seeding a test database with a thousand primary keys that sort in creation order
  • Creating idempotency keys for a batch of API requests
  • Choosing between v4 and v7 for a new table by comparing the strings side by side
  • Working out roughly when a record was created from a v7 key in a log
  • Making short, URL-safe slugs for share links with a Nano ID

Building one

  1. Pick a type from the menu: v4, v7, ULID, monotonic ULID, Nano ID, nil or max.
  2. Set how many you need, up to 1,000, and choose case, hyphens, braces or the urn prefix (UUIDs) or the length and alphabet (Nano ID).
  3. Press Generate and check the list.
  4. Copy a single value, copy all, or download a .txt or .csv file.
  5. To inspect an existing ID, open Validate and decode and paste it.

Example

Decoder input (RFC 9562 sample v6 value)

1ec9414c-232a-6b00-b3c8-9f6bdeced846

Decoded

Kind: UUID
Version: 6 (reordered Gregorian time)
Variant: RFC 4122 / RFC 9562 (10xx)
Embedded time: 2022-02-22T19:22:22.000Z

ULID 01ARZ3NDEKTSV4RRFFQ69G5FAV decodes to 1469922850259 ms, 2016-07-30T23:54:10.259Z

Tips for best results

  • Prefer v7 or ULID for database primary keys that are indexed: new rows land near each other instead of scattering across the index.
  • Keep hyphens unless the target system asks otherwise; most parsers expect them.
  • Shorten a Nano ID only after estimating how many IDs you will create. A 10-character ID from 64 symbols has 60 bits, which is plenty for thousands of records and risky for billions.
  • When pasting into a spreadsheet, use the .csv download so IDs with leading digits are not read as numbers.
  • Use the nil UUID as a clearly recognisable placeholder in fixtures, not as a real key.

Things to check before you rely on it

A v7 UUID or a ULID reveals when it was created. If the ID is public, anyone can read that time off it; use v4 or Nano ID when creation time should stay private.

Monotonic order here holds within this page and this tab. Two machines or two tabs generating IDs in the same millisecond cannot coordinate, so cross-machine ordering is by time first and random bits after.

Lower and upper case represent the same UUID, but some systems compare them as plain text. Pick one case and keep it.

A Nano ID alphabet with repeated characters would make those characters more likely, so the tool refuses duplicates instead of silently allowing them.

The decoder reads whatever the bits say. A UUID written by hand, or a v8 value, may have a version digit that means nothing in practice.

Common errors and how to fix them

"How many must be a whole number from 1 to 1,000."
Type a whole number in the range. For more than 1,000 IDs, generate several batches and join the files.
"The alphabet repeats a character."
Remove the repeated characters, or press the default alphabet button to restore the 64-character set.
The decoder says the hyphens are not in the 8-4-4-4-12 positions.
Move the hyphens to those positions, or delete them all so the 32 hex digits stand alone.
The decoder rejects a 26-character string for a character such as I, L, O or U.
ULIDs do not use those letters. Check for a typing or copy error, or whether the value is a different kind of ID.

Best practices

  • Store UUIDs in a native uuid or 16-byte column rather than as text where your database supports it.
  • Decide on case and hyphen style once and normalise on input.
  • Do not treat any of these IDs as secrets: they are identifiers, not authorisation tokens.
  • Test ordering assumptions by generating a batch here and sorting it as text.

v4, v7 or ULID?

Version 4 is 122 random bits with the version and variant bits fixed. It carries no information and sorts randomly, which is fine for identifiers that are looked up by exact value and awkward for a clustered index that wants neighbours to be created together.

Version 7 and ULID both begin with a millisecond timestamp, so sorting them as text sorts them by creation time. They differ in shape: v7 is a standard UUID that every UUID column and library accepts, while ULID is 26 characters of base32 and reads more compactly in URLs. Both allow some ordering within a millisecond only if the generator takes care of it, which is what the monotonic options on this page do.

Frequently asked questions

How long do generated IDs stay available?

They live only in the open page. Close or reload the tab and the list is gone, so download the .txt or .csv first if you need to keep a batch. The generator's code makes no network request.

How does v7 stay in order within one millisecond?

It puts a 12-bit counter after the version digit, starting at a random value below 2048 and adding one per ID. If the counter would overflow, the timestamp moves forward by a millisecond.

Can the decoder read a Nano ID?

No. A Nano ID is just random characters from your alphabet and has no version or time inside it.

What is the difference between the nil and max UUIDs?

The nil UUID is all zero bits and the max UUID is all one bits. Both are reserved values defined by RFC 9562 and are useful as placeholders in tests.

Why do the first characters of my v7 IDs look the same?

They hold the timestamp. IDs created within the same few seconds share the leading digits.