Free tool · Developer tools
ULID generator
Make one ULID or thousands, with the current time or a time you choose, and copy them in the layout your code needs. You can also paste a ULID to read its time: 01ARZ3NDEKTSV4RRFFQ69G5FAV decodes to 2016-07-30T23:54:10.259Z.
- Free
- No sign-up
- Runs in your browser
5 ULIDsMade in your browser. Each one sorts after the one before it.
- 48-bit time + 80 random bits
- crypto.getRandomValues
- Count
- 5
- Length each
- 26 characters
- Time inside the first
- 2026-11-28T12:00:00.000Z
2016-07-30T23:54:10.259ZTime stored in the first 10 characters (UTC)
- Time (your device)
- Unix milliseconds
- 1469922850259
- Unix seconds
- 1469922850.259
- Time part (10 characters)
- 01ARZ3NDEK
- Random part (16 characters)
- TSV4RRFFQ69G5FAV
- Random part in hex (80 bits)
- d6764c61efb99302bd5b
- Same 128 bits as a UUID
- 01563e3a-b5d3-d676-4c61-efb99302bd5b
- Next in the same millisecond
- 01ARZ3NDEKTSV4RRFFQ69G5FAW
How to use the ULID Generator
- Keep Generate ULIDs selected, type a number under How many (1 to 5,000) and read the list on the right. Generate again makes a new set.
- To stamp a specific moment, fill Time to put inside with Unix milliseconds or an ISO date. Leave it empty for the current time.
- Choose Lowercase if you want it, pick a layout under List as, then press Copy or Download.
- To read a ULID, choose Decode a ULID and paste it. The time, the random part, the same bits as a UUID and the next ULID in the same millisecond appear.
What is a ULID?
A ULID is a 128 bit identifier written as 26 characters, such as 01ARZ3NDEKTSV4RRFFQ69G5FAV. The first 10 characters hold a timestamp, the number of milliseconds since 1970-01-01 UTC, and the last 16 characters hold 80 random bits. The letters come from Crockford's Base32 alphabet, 0123456789ABCDEFGHJKMNPQRSTVWXYZ, which leaves out I, L, O and U so that a ULID is easy to read aloud and hard to mistype.
Because the time comes first and the alphabet is in ascending order, sorting ULIDs as plain text puts them in the order they were made. Ten characters can store 48 bits, which makes the largest time 7ZZZZZZZZZ, or 281,474,976,710,655 ms. That is 10889-08-02T05:31:50.655Z, so a ULID made today has the first character 0 and will keep it for a very long time. Any first character above 7 would overflow the 48 bits, so the decoder here rejects it.
How do I read the time inside a ULID?
Take the first 10 characters and treat each as a digit in base 32, using its place in the alphabet as its value. For 01ARZ3NDEK the values are 0, 1, 10, 24, 31, 3, 21, 13, 14 and 19. Multiply each by 32 raised to its place, counting from 9 on the left down to 0 on the right, and add the results. The sum is 1,469,922,850,259, which is 2016-07-30T23:54:10.259Z in UTC.
Pasting a ULID into Decode a ULID does this sum for you and also shows Unix seconds, the time on your own device and the random part in hex. Lowercase is read the same as uppercase, and quotes around the value are ignored. A ULID with a wrong length, or with a letter outside the alphabet, gets a message that says which.
| Place | Character | Value | Contribution |
|---|---|---|---|
| 1 | 0 | 0 | 0 × 32^9 |
| 2 | 1 | 1 | 1 × 32^8 |
| 3 | A | 10 | 10 × 32^7 |
| 4 | R | 24 | 24 × 32^6 |
| 5 | Z | 31 | 31 × 32^5 |
| 6 | 3 | 3 | 3 × 32^4 |
| 7 | N | 21 | 21 × 32^3 |
| 8 | D | 13 | 13 × 32^2 |
| 9 | E | 14 | 14 × 32^1 |
| 10 | K | 19 | 19 × 32^0 |
What happens when two ULIDs are made in the same millisecond?
A generator that drew fresh random bits every time could put two ULIDs from one millisecond in any order. The ULID spec avoids that by adding 1 to the random part of the previous ULID when the time has not moved, carrying over like an odometer. The spec's own example goes from 01BX5ZZKBKACTAV9WEVGEMMVRZ to 01BX5ZZKBKACTAV9WEVGEMMVS0. This page does the same, so a list of 5,000 ULIDs made in a burst is strictly increasing.
When the clock moves forward the generator draws new random bits. If the clock goes backwards, the time part of the last ULID is kept so the order never breaks. The spec says generation should fail when the random part overflows; this page moves the time forward by one millisecond with fresh random bits instead, which keeps the list sorted. The case needs random bits at the very top of the range, so it almost never happens. The rows below show three ULIDs from one millisecond and one from the next.
| No. | Time part | Random part | When |
|---|---|---|---|
| 1 | 01M8H0DJG0 | NJQDMXEKS7YFNP3G | same millisecond |
| 2 | 01M8H0DJG0 | NJQDMXEKS7YFNP3H | same millisecond |
| 3 | 01M8H0DJG0 | NJQDMXEKS7YFNP3J | same millisecond |
| 4 | 01M8H0DJG1 | 1QHQTZ69QJF7JZ6H | one millisecond later |
ULID or UUID: what is the difference?
Both are 128 bits. A UUID is written as 36 characters in groups of 8-4-4-4-12 and a ULID as 26 characters with no hyphens, so a ULID is shorter in a URL or a file name. Every character of a ULID is a digit or a capital letter, and none needs escaping. The ULID of the sample, written as a UUID, is 01563e3a-b5d3-d676-4c61-efb99302bd5b: the Decode view shows that form so you can store the same value in a UUID column.
A UUID version 4 is almost entirely random, so it carries no time and does not sort by creation. A UUID version 7 also starts with a millisecond time, and the UUID generator makes both versions. Pick the one your database or API already expects. The random part of a ULID is 80 bits, which gives 2^80, about 1.2 septillion, values for every millisecond.
Every value on this page is made by the script in your browser from the browser's secure random source. Nothing is posted anywhere, and a ULID is not a secret, so do not use one as a password or an access token.
Use it with
- Unix Timestamp Converter: epoch to date and back.
- Random Number Generator: numbers in a range, no repeats.
- Password Generator: strong random passwords.
Questions
What is a ULID?
A 128 bit identifier written as 26 characters: 10 for a millisecond timestamp and 16 for 80 random bits, in Crockford Base32. It sorts by creation time as plain text.
How long is a ULID, and which characters can it contain?
26 characters from 0123456789ABCDEFGHJKMNPQRSTVWXYZ. The letters I, L, O and U are not used.
How do I get the date from a ULID?
Read the first 10 characters as a base 32 number of milliseconds since 1970-01-01 UTC. 01ARZ3NDEK is 1,469,922,850,259 ms, which is 2016-07-30T23:54:10.259Z. Paste any ULID into Decode a ULID to see it.
Do ULIDs sort in the order they were made?
Yes for ULIDs from one generator. The time comes first, and ULIDs from the same millisecond get a random part that rises by 1, so a plain text sort gives creation order.
Can I turn a ULID into a UUID?
Yes, they have the same 128 bits. Write the 32 hex digits of the ULID in 8-4-4-4-12 groups: 01ARZ3NDEKTSV4RRFFQ69G5FAV becomes 01563e3a-b5d3-d676-4c61-efb99302bd5b. The Decode view shows this form.
Can two ULIDs be the same?
Two ULIDs from different generators in the same millisecond collide only if their 80 random bits match, one chance in 2^80. Within one generator on this page, the next ULID in the same millisecond is always larger than the one before.
The tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations are checked against the tool's own output.