How to use the ulid generator
- Select Generate or Decode from the mode dropdown.
- For generation, optionally enter a Unix timestamp in milliseconds and choose how many ULIDs you need.
- Enable Monotonic if you want batch-generated IDs within the same millisecond to sort strictly in order.
- Click Generate to produce the identifiers or decode the provided ULID.
- Copy the results directly from the output area.
How ULID encoding works
A ULID is a 128-bit identifier encoded as a 26-character string using Crockford's Base32 alphabet. The first 48 bits store a Unix timestamp in milliseconds, and the remaining 80 bits are cryptographically random. This structure means every ULID is naturally sortable by creation time without needing a separate date column.
The encoding splits into two parts: 10 characters for the timestamp and 16 for the randomness. For example, the timestamp 1469918176385 converts to the prefix 01ARYZ6S41. To compute this manually, repeatedly divide the millisecond value by 32 and map each remainder to the Crockford alphabet (0123456789ABCDEFGHJKMNPQRSTVWXYZ). The result is always exactly 10 characters, zero-padded on the left.
ULID vs UUID
When comparing ULID vs UUID, the main difference is sortability. Standard UUIDs (version 4) are entirely random, which makes them poor candidates for database primary keys because they cause index fragmentation. UUIDv7 addresses this by embedding a timestamp, but ULID was designed for lexicographic sorting from the start.
ULIDs are also shorter to type and read: 26 characters compared to the 36-character hyphenated UUID format. Both provide 128 bits of total information, but ULID dedicates 48 bits to time and 80 bits to randomness, whereas UUIDv4 uses 122 bits for randomness. If you need purely random identifiers without a timestamp component, a UUID generator may be more appropriate.
Monotonic generation
When you generate multiple ULIDs within the exact same millisecond, standard random generation does not guarantee that the second ID will sort after the first. Monotonic mode solves this by detecting when the timestamp matches the previous generation and incrementing the random portion by one instead of generating new random bits.
This ensures that a batch of ULIDs created at timestamp 1000 will always be strictly increasing in their final 16 characters. If the random portion overflows (all Zs), the generator returns an error rather than producing an invalid ID. Monotonicity only applies within a single batch sharing the same timestamp.
Common reference values
The following table shows how specific Unix millisecond timestamps map to their 10-character ULID prefixes:
| Timestamp (ms) | ISO Time | ULID Prefix |
|---|---|---|
| 0 | 1970-01-01T00:00:00.000Z | 0000000000 |
| 1469918176385 | 2016-07-30T22:36:16.385Z | 01ARYZ6S41 |
| 1000000000000 | 2001-09-09T01:46:40.000Z | 00X3AAA400 |
| 281474976710655 | +010889-08-02T05:31:50.655Z | 7ZZZZZZZZZ |
The maximum valid timestamp is 281474976710655 ms. Any value above this exceeds the 48-bit limit and cannot be represented in a valid ULID.
Decoding a ULID
To use this tool as a ULID decoder, switch the mode to Decode and paste a 26-character string. The decoder extracts the first 10 characters, maps each character back to its 5-bit integer value using Crockford's Base32, and reconstructs the 48-bit timestamp. It then converts that millisecond value into a human-readable ISO 8601 date string.
Characters outside the Crockford alphabet (such as I, L, O, U, or lowercase letters that do not map cleanly) will trigger a validation error. The decoder also verifies that the first character does not exceed 7, which would indicate a timestamp overflow beyond the 48-bit capacity.
Worked examples
| Example | Input | Result |
|---|---|---|
| Single ULID | Mode: generate; Count: 1; Monotonic: no | 01M6Q6MTHX2V62F6A04CSF49AH |
| Batch with fixed timestamp | Mode: generate; Count: 5; Timestamp (ms): 1469918176385; Monotonic: yes | 01ARYZ6S41N3QCSG79ED8BDHGD, 01ARYZ6S41N3QCSG79ED8BDHGE, 01ARYZ6S41N3QCSG79ED8BDHGF, 01ARYZ6S41N3QCSG79ED8BDHGG, 01ARYZ6S41N3QCSG79ED8BDHGH |
| Decode example ULID | Mode: decode; Count: 1; Monotonic: no; ULID to decode: 01ARYZ6S41TSV4RRFFQ69G5FAV | Timestamp (ms): 1,469,918,176,385; Date (ISO 8601): 2016-07-30T22:36:16.385Z; Randomness: TSV4RRFFQ69G5FAV |
FAQ
What is a ULID?
A ULID is a Universally Unique Lexicographically Sortable Identifier. It is a 128-bit value encoded as a 26-character string using Crockford's Base32 alphabet, combining a 48-bit Unix timestamp with 80 bits of randomness.
How does this ULID generator handle timestamps?
If you leave the timestamp field empty, it uses the current time. If you provide a specific Unix millisecond value, it encodes that exact time into the first 10 characters of every generated ULID.
What does the monotonic option do?
Monotonic mode ensures that when you generate multiple ULIDs for the same millisecond, each subsequent ID has a strictly greater random component. This guarantees correct lexicographic sorting within the same timestamp.
Is a ULID better than a UUID?
It depends on the use case. ULIDs are sortable by time and shorter to type, making them ideal for database keys. UUIDs (especially v4) offer more randomness but lack natural sorting. See our UUID generator if you need standard UUIDs.
Can I decode any ULID with this tool?
Yes. Switch the mode to Decode, paste a valid 26-character ULID, and the tool will return the embedded Unix timestamp in milliseconds along with the corresponding ISO 8601 date and time.
Are the generated ULIDs secure?
The random portion uses your browser's cryptographic random number generator. However, because the timestamp is predictable, ULIDs should not be used as secret tokens. For opaque secrets, consider a dedicated token generator or password generator.