Skip to main content
ponderloop

ULID Generator

A ULID is a 128-bit identifier written as 26 Crockford base32 characters: a 48-bit Unix millisecond timestamp (10 characters) followed by 80 random bits (16 characters), so ULIDs sort by creation time as plain text. The example 01ARZ3NDEKTSV4RRFFQ69G5FAV was created at 2016-07-30T23:54:10.259Z (Unix time 1469922850259 ms). A UUID v4 has no time and 122 random bits in 36 characters, and a UUID v7 has the same 48-bit timestamp but 74 random bits. Generate 1 to 100 ULIDs below on this device, make them for a time you choose, or paste a ULID to read its date and randomness and check that it is valid.

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

Generate ULIDs

Unix milliseconds or an ISO date such as 2022-02-22T19:22:22Z. No zone means UTC. Leave empty for the current time.

Options
Made on your device

This example is printed in the page itself, so do not reuse it. With JavaScript on, the page makes fresh ULIDs on this device.

Decode and validate a ULID

Valid ULID, created 2016-07-30T23:54:10.259Z

ULID (upper case)
01ARZ3NDEKTSV4RRFFQ69G5FAV
Created (UTC, ISO 8601)
2016-07-30T23:54:10.259Z
Created (your local time)
Shown in your time zone once this page has loaded
Unix time (milliseconds)
1469922850259
Timestamp part (10 characters)
01ARZ3NDEK
Randomness part (16 characters)
TSV4RRFFQ69G5FAV
Randomness (80 bits, hex)
d6764c61efb99302bd5b
All 128 bits (hex)
01563e3ab5d3d6764c61efb99302bd5b

ULIDs are made with your browser’s Web Crypto random number generator, and the decoder only reads what you type. A ULID identifies something and shows when it was made; it is not a secret, so do not use one as a password or access token.

ULID compared with UUID v4 and v7

All three are 128-bit identifiers. The bit counts are those the tool itself uses; UUID fields are from RFC 9562.
PropertyULIDUUID v4UUID v7
Size128 bits128 bits128 bits
Written as26 characters, Crockford base3236 characters, hex with hyphens36 characters, hex with hyphens
Timestamp48 bits, Unix millisecondsNone48 bits, Unix milliseconds
Random80 bits122 bits74 bits
Version and variant bits0 bits6 bits6 bits
Sorts by creation time as textYesNoYes
Letter caseUpper case by convention; readers accept bothLower case by convention; readers accept bothLower case by convention; readers accept both
Defined byThe ULID specification (community)RFC 9562RFC 9562

Where the 128 bits of a ULID go

The example 01ARZ3NDEKTSV4RRFFQ69G5FAV split into its two parts. 26 characters hold 130 bits, so the first character can only be 0 to 7.
PartCharactersBitsRangeIn the example
Timestamp10480 to 281,474,976,710,655 ms, up to +010889-08-02T05:31:50.655Z01ARZ3NDEK = 1469922850259 ms
Randomness16800 to 1,208,925,819,614,629,174,706,175 (1,208,925,819,614,629,174,706,176 values)TSV4RRFFQ69G5FAV = 0xd6764c61efb99302bd5b
Whole ULID261282 unused bits at the front01ARZ3NDEKTSV4RRFFQ69G5FAV

The Crockford base32 alphabet

Value 0 is the first symbol and value 31 the last. Characters sort in this order in ASCII too, which is why ULIDs sort as text.
ValuesSymbolsNotes
0 to 701234567The only characters a ULID may start with
8 to 1589ABCDEFDigits 8 and 9, then A to F
16 to 23GHJKMNPQG H J K M N P Q: I, L and O are skipped
24 to 31RSTVWXYZR S T V W X Y Z: U is skipped
Not usedILOURejected by the validator

ULID timestamp part by date

The 10-character timestamp part for midnight UTC on 1 January of each year, from the tool’s own encoder.
Date (UTC)Unix time (ms)Timestamp part
1970-01-0100000000000
2000-01-0194668480000000VHNCZB00
2010-01-011262304000000014QKJWY00
2020-01-01157783680000001DXF6DT00
2025-01-01173568960000001JGFJJZ00
2026-01-01176722560000001KDVDNA00
2030-01-01189345600000001Q3DCBD00
2050-01-012524608000000029F75SW00
2100-01-01410244480000003QCPC7P00

Worked examples

Each result is the tool’s own output. The sequence uses a fixed clock and all-zero random bytes so it is the same every time.
CaseInputResult
Decode a ULID01ARZ3NDEKTSV4RRFFQ69G5FAV2016-07-30T23:54:10.259Z (1469922850259 ms)
The earliest ULID, at the Unix epochTimestamp 0, randomness all zero00000000000000000000000000
The latest ULIDTimestamp 281474976710655, randomness all ones7ZZZZZZZZZZZZZZZZZZZZZZZZZ (+010889-08-02T05:31:50.655Z)
Three monotonic ULIDs in one millisecondTimestamp 1645557742000 (2022-02-22T19:22:22.000Z), zero random start01FWHE4YDG0000000000000000, 01FWHE4YDG0000000000000001, 01FWHE4YDG0000000000000002
Lower case is accepted01arz3ndektsv4rrffq69g5fav2016-07-30T23:54:10.259Z, same ULID as 01ARZ3NDEKTSV4RRFFQ69G5FAV
A letter outside the alphabet01ARZ3NDEKTSV4RRFFQ69G5FAU“U” is not in the ULID alphabet: use 0 to 9 and A to Z without I, L, O and U.
A first character above 781ARZ3NDEKTSV4RRFFQ69G5FAVA ULID cannot start with “8”: the first character must be 0 to 7, or the 48-bit timestamp overflows.
Too short01ARZ3NDEKTSV4RRFFQ6A ULID has 26 characters; this has 20.

How to generate and decode ULIDs

  1. Choose how many. Enter a count from 1 to 100. The list updates as you change it.
  2. Set the options. Keep monotonic on to make ULIDs created in the same millisecond sort in creation order, or turn it off for independent random parts. Tick lower case if your system stores them that way, for example 01arz3ndektsv4rrffq69g5fav.
  3. Pick the time. Leave it on the current time, or choose a time: Unix milliseconds such as 1645557742000, or an ISO date such as 2022-02-22T19:22:22Z. Every ULID in the list then carries that time (10 characters, 01FWHE4YDG).
  4. Copy the list. Press Copy all to put the ULIDs, one per line, on your clipboard. Generate new makes a fresh list.
  5. Decode or validate a ULID. Paste a ULID into the decoder to see its creation time in UTC and your time zone, its Unix time, its random part, or the reason it is not valid.

Frequently asked questions

What is a ULID?
ULID stands for Universally Unique Lexicographically Sortable Identifier. It is 128 bits: 48 bits of Unix time in milliseconds, then 80 random bits, written as 26 characters of Crockford base32 (for example 01ARZ3NDEKTSV4RRFFQ69G5FAV). Because the time comes first and the alphabet is in ASCII order, sorting ULIDs as strings sorts them by creation time.
What is the difference between a ULID and a UUID?
Both are 128 bits. A UUID v4 is 122 random bits with no time, so it does not sort; a UUID v7 and a ULID both start with a 48-bit millisecond timestamp. A ULID has no version or variant bits, so it keeps 80 random bits where v7 keeps 74, and it is 26 characters rather than 36. UUIDs are standardised in RFC 9562 and many databases have a native UUID column type; a ULID is a community specification.
Can I store a ULID in a UUID column?
The 128 bits fit: the example is 01563e3ab5d3d6764c61efb99302bd5b as hex, or 01563e3a-b5d3-d676-4c61-efb99302bd5b written as a UUID. It is not a valid RFC 9562 UUID, though: its version digit is d and its variant digit is 4, because a ULID does not reserve those bits. A database that only stores 16 bytes accepts it; a library that checks the version and variant bits can reject it.
Why are ULIDs 26 characters and why can the first one only be 0 to 7?
Each base32 character carries 5 bits, so 26 characters can hold 130, which is 2 more than the 128 a ULID needs. Those bits sit in the first character, leaving it 3 bits: 0 to 7. A first character of 8 or more would mean a timestamp above 281,474,976,710,655, so the validator rejects it (try 81ARZ3NDEKTSV4RRFFQ69G5FAV).
How does the monotonic option keep ULIDs in order?
Two ULIDs made in the same millisecond have the same timestamp, so random parts alone would put them in random order. In monotonic mode the first ULID of a millisecond gets a fresh random part and each further one adds 1 to it, as the spec describes: for example 01FWHE4YDG0000000000000000, 01FWHE4YDG0000000000000001, 01FWHE4YDG0000000000000002. If the clock stands still or steps back, the generator keeps the last timestamp and keeps counting. The 80-bit part would have to overflow to break this, which the generator handles by moving to the next millisecond.
How likely is a collision?
Only ULIDs made in the same millisecond can collide, and then only if their 80 random bits match. Using the birthday approximation, you would need about 1.3 trillion ULIDs in a single millisecond for a 50% chance of a repeat, and about 49.2 million for a one in a billion chance. In monotonic mode one generator never repeats itself, but two independent generators in the same millisecond are in the same position as random ones.
How do I get the creation time out of a ULID?
Decode the first 10 characters as a base32 number: 01ARZ3NDEK is 1469922850259, the number of milliseconds since 1970-01-01 UTC, which is 2016-07-30T23:54:10.259Z. The decoder above shows that, the same moment in your own time zone and the random part. The time is whatever clock the generating system had, so it can be wrong by as much as that clock was, and it makes a ULID reveal when it was created to the millisecond.
Why do many ULIDs begin with the same characters?
The leading characters are the high digits of the timestamp, so they change slowly. Every ULID made from 2004-11-03 to 2039-09-07 starts with 01, and the first character stays 0 until 3084-12-12. That is what makes plain text sorting work; the characters that tell two ULIDs from the same moment apart are at the end.
Why does a ULID leave out the letters I, L, O and U?
Crockford’s base32 drops I, L, O and U. I and L are easily mistaken for 1, O for 0, and U is left out to avoid accidental obscenities. A reader that follows his full rules treats I and L as 1 and O as 0; this validator is stricter and reports them, because a ULID produced by a spec-following generator never contains them.
Can I use a ULID as a password or secret token?
No. A ULID is built to be unique and sortable, not secret: its first 10 characters are a guessable time, which leaves 80 bits, and ULIDs often end up in URLs and logs. Use a token from a password or secret generator for anything that grants access.
Where do the random bits come from, and when do ULIDs run out?
The random part is read from crypto.getRandomValues, the browser’s cryptographically secure generator, never Math.random, and the list exists only in this tab and on your clipboard once you copy it. The 48-bit timestamp lasts until +010889-08-02T05:31:50.655Z, so ULIDs will not run out in any practical lifetime.
What does generating for a chosen time do?
It stamps every ULID in the list with that moment instead of the clock, which is useful for tests of sort order, backfilled data or fixtures. Enter Unix milliseconds, or an ISO date: without a zone the time is read as UTC, so 1645557742000 and 2022-02-22T19:22:22Z give the same 10-character start, 01FWHE4YDG. Keep monotonic on if the list must sort in creation order.

How it works

A ULID is built as in the ULID specification: the timestamp, as a whole number of Unix milliseconds up to 281,474,976,710,655, is written as 10 base32 characters, most significant first, followed by 16 characters for 80 random bits taken from crypto.getRandomValues. The alphabet is 0123456789ABCDEFGHJKMNPQRSTVWXYZ, in that order, so character order and numeric order agree. In monotonic mode the first ULID of a millisecond gets a new random part and each later ULID with the same (or an earlier) timestamp reuses the last timestamp and adds one to the last random part; the generator is kept between presses of the button, so one page stays in order. The decoder trims spaces, upper-cases the text, checks the length, the alphabet and that the first character is at most 7, then reads the numbers back. A time you choose is taken as Unix milliseconds if it is only digits, otherwise as an ISO 8601 date or date and time, in UTC when no zone is given. The collision figures use the birthday approximation n ≈ √(2 · 2^80 · ln(1/(1 − p))) for ULIDs sharing one millisecond. The example is fixed, so the page looks the same whenever it is built.

Sources

All passwords & securityAll toolsHome & DIY calculators