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.
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
| Property | ULID | UUID v4 | UUID v7 |
|---|---|---|---|
| Size | 128 bits | 128 bits | 128 bits |
| Written as | 26 characters, Crockford base32 | 36 characters, hex with hyphens | 36 characters, hex with hyphens |
| Timestamp | 48 bits, Unix milliseconds | None | 48 bits, Unix milliseconds |
| Random | 80 bits | 122 bits | 74 bits |
| Version and variant bits | 0 bits | 6 bits | 6 bits |
| Sorts by creation time as text | Yes | No | Yes |
| Letter case | Upper case by convention; readers accept both | Lower case by convention; readers accept both | Lower case by convention; readers accept both |
| Defined by | The ULID specification (community) | RFC 9562 | RFC 9562 |
Where the 128 bits of a ULID go
| Part | Characters | Bits | Range | In the example |
|---|---|---|---|---|
| Timestamp | 10 | 48 | 0 to 281,474,976,710,655 ms, up to +010889-08-02T05:31:50.655Z | 01ARZ3NDEK = 1469922850259 ms |
| Randomness | 16 | 80 | 0 to 1,208,925,819,614,629,174,706,175 (1,208,925,819,614,629,174,706,176 values) | TSV4RRFFQ69G5FAV = 0xd6764c61efb99302bd5b |
| Whole ULID | 26 | 128 | 2 unused bits at the front | 01ARZ3NDEKTSV4RRFFQ69G5FAV |
The Crockford base32 alphabet
| Values | Symbols | Notes |
|---|---|---|
| 0 to 7 | 01234567 | The only characters a ULID may start with |
| 8 to 15 | 89ABCDEF | Digits 8 and 9, then A to F |
| 16 to 23 | GHJKMNPQ | G H J K M N P Q: I, L and O are skipped |
| 24 to 31 | RSTVWXYZ | R S T V W X Y Z: U is skipped |
| Not used | ILOU | Rejected by the validator |
ULID timestamp part by date
| Date (UTC) | Unix time (ms) | Timestamp part |
|---|---|---|
| 1970-01-01 | 0 | 0000000000 |
| 2000-01-01 | 946684800000 | 00VHNCZB00 |
| 2010-01-01 | 1262304000000 | 014QKJWY00 |
| 2020-01-01 | 1577836800000 | 01DXF6DT00 |
| 2025-01-01 | 1735689600000 | 01JGFJJZ00 |
| 2026-01-01 | 1767225600000 | 01KDVDNA00 |
| 2030-01-01 | 1893456000000 | 01Q3DCBD00 |
| 2050-01-01 | 2524608000000 | 029F75SW00 |
| 2100-01-01 | 4102444800000 | 03QCPC7P00 |
Worked examples
| Case | Input | Result |
|---|---|---|
| Decode a ULID | 01ARZ3NDEKTSV4RRFFQ69G5FAV | 2016-07-30T23:54:10.259Z (1469922850259 ms) |
| The earliest ULID, at the Unix epoch | Timestamp 0, randomness all zero | 00000000000000000000000000 |
| The latest ULID | Timestamp 281474976710655, randomness all ones | 7ZZZZZZZZZZZZZZZZZZZZZZZZZ (+010889-08-02T05:31:50.655Z) |
| Three monotonic ULIDs in one millisecond | Timestamp 1645557742000 (2022-02-22T19:22:22.000Z), zero random start | 01FWHE4YDG0000000000000000, 01FWHE4YDG0000000000000001, 01FWHE4YDG0000000000000002 |
| Lower case is accepted | 01arz3ndektsv4rrffq69g5fav | 2016-07-30T23:54:10.259Z, same ULID as 01ARZ3NDEKTSV4RRFFQ69G5FAV |
| A letter outside the alphabet | 01ARZ3NDEKTSV4RRFFQ69G5FAU | “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 7 | 81ARZ3NDEKTSV4RRFFQ69G5FAV | A ULID cannot start with “8”: the first character must be 0 to 7, or the 48-bit timestamp overflows. |
| Too short | 01ARZ3NDEKTSV4RRFFQ6 | A ULID has 26 characters; this has 20. |
How to generate and decode ULIDs
- Choose how many. Enter a count from 1 to 100. The list updates as you change it.
- 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.
- 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).
- Copy the list. Press Copy all to put the ULIDs, one per line, on your clipboard. Generate new makes a fresh list.
- 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
More free tools
- UUID GeneratorGenerate random v4 and time-ordered v7 UUIDs on your device, up to 1,000 at a time, and inspect any UUID for its version, variant and embedded timestamp.
- Base32, Base58 & Base85Encode and decode Base32, Crockford Base32, Base58, Base58Check, Ascii85 and Z85 from text or hex bytes, with exact error positions. Runs in your browser.
- Password GeneratorMake a strong random password or passphrase on your device: choose length and characters, see its strength in bits and copy it. Nothing is sent.
- Password Strength CheckerCheck how strong your password is: a 0–4 score, crack times, and the patterns that weaken it, with tips to fix them. Checked on your device, never sent.
- Hash GeneratorHash text or a file with SHA-256, SHA-1, SHA-384, SHA-512, MD5 and CRC32, add an HMAC key, and check a checksum. Runs in your browser; nothing is uploaded.
- JWT DecoderDecode a JWT to its header and payload, read exp, iat and nbf as UTC times, spot expired or alg none tokens, and check HMAC signatures. Runs locally.