ToolNimba Browse

🆔 ULID Generator

By ToolNimba Web Dev Team · Updated 2026-06-19

    Choose a count and press Generate.

    A ULID (Universally Unique Lexicographically Sortable Identifier) is a 26-character ID that is globally unique and naturally sorts by the time it was created. This generator builds ULIDs entirely in your browser: a 48-bit millisecond timestamp encoded as the first 10 characters, plus 80 bits of crypto-strong randomness as the final 16 characters. Choose how many you need, copy individually or all at once, and use them as database keys, log IDs, or anywhere you want UUID-style uniqueness with time ordering built in.

    What is the ULID Generator?

    A ULID packs two pieces of information into 26 characters of Crockford base32: time and randomness. The first 10 characters encode the number of milliseconds since the Unix epoch (1 January 1970) as a 48-bit integer, which is enough to represent dates well past the year 10000. The remaining 16 characters are 80 bits of randomness drawn from a cryptographically secure source, the same kind that backs crypto.getRandomValues in the browser. Together that is 128 bits of identifier, the same width as a UUID, so the chance of two ULIDs created in the same millisecond colliding is astronomically small.

    The headline feature is that ULIDs are lexicographically sortable. Because the timestamp sits at the front and base32 preserves ordering, sorting a list of ULIDs as plain text automatically puts them in the order they were generated. This is something a random UUID v4 cannot do: UUID v4 has no time component, so it scatters randomly across an index. Sortable IDs are friendlier to databases, because new rows append to the end of a B-tree index rather than landing in random spots, which reduces page splits and keeps inserts fast.

    ULID uses Crockford base32, an alphabet of 32 symbols (0 to 9 and A to Z) that deliberately omits the letters I, L, O and U. Dropping those characters avoids confusion with 1, 0 and obscene words, and makes ULIDs safe to read aloud, type by hand, or use in URLs and filenames without escaping. ULIDs are case-insensitive on decode, so you can store them uppercase (the canonical form) or lowercase to taste. They contain no special characters, so they need no encoding in JSON, query strings, or HTML attributes.

    When to use it

    • Primary keys for database rows where you want global uniqueness plus natural creation-time ordering in the index.
    • Correlation or request IDs in logs and traces, so entries sort chronologically without a separate timestamp column.
    • Distributed systems that generate IDs on many nodes at once without a central counter or coordination.
    • File names, object-storage keys, or URL slugs that need to be unique, URL-safe, and roughly time-ordered.
    • Replacing UUID v4 where random scatter hurts insert performance on large indexed tables.

    How to use the ULID Generator

    1. Enter how many ULIDs you want to generate (1 to 50).
    2. Press Generate to create the batch in your browser.
    3. Leave Monotonic checked to keep the batch in strict generation order, or uncheck it for plain time-based ULIDs.
    4. Toggle Lowercase if you prefer lowercase output over the canonical uppercase form.
    5. Click Copy next to any ULID, or Copy all to grab the whole list at once.

    Formula & method

    ULID = timestamp(10 chars) + randomness(16 chars). The first 10 characters encode milliseconds since 1970 as a 48-bit integer in Crockford base32; the last 16 characters encode 80 random bits. Total length is 26 characters (128 bits).

    Worked examples

    Encoding the timestamp portion for a known millisecond value.

    1. Take the time in milliseconds, for example 1469918176385.
    2. Express it as a 48-bit integer and split it into 10 base32 digits.
    3. Map each 5-bit group to the Crockford alphabet 0123456789ABCDEFGHJKMNPQRSTVWXYZ.
    4. The 48-bit value 1469918176385 encodes to the 10 characters 01ARYZ6S41.

    Result: Timestamp prefix = 01ARYZ6S41, which any ULID parser can decode back to 1469918176385 ms.

    Assembling a full ULID from its two halves.

    1. Compute the 10-character timestamp prefix, for example 01ARYZ6S41.
    2. Generate 80 random bits with crypto.getRandomValues and encode them as 16 base32 chars, for example DEADBEEFDEADBEEF.
    3. Concatenate the prefix and the random suffix.
    4. The result is a single 26-character string.

    Result: Full ULID = 01ARYZ6S41DEADBEEFDEADBEEF (10 + 16 = 26 characters).

    ULID structure at a glance

    PartCharactersBitsHolds
    TimestampFirst 1048Milliseconds since 1970
    RandomnessLast 1680Crypto-random entropy
    Total26128The full identifier

    ULID compared with UUID v4

    FeatureULIDUUID v4
    Length26 chars36 chars (with dashes)
    Sortable by timeYesNo
    EncodingCrockford base32Hexadecimal
    Total bits128128
    URL-safe without escapingYesYes

    Common mistakes to avoid

    • Expecting ULIDs to hide the creation time. The first 10 characters openly encode the millisecond timestamp, so anyone can decode roughly when a ULID was made. If the creation time must stay secret, use a fully random identifier like UUID v4 instead.
    • Assuming ULIDs are unguessable security tokens. Only the last 80 bits are random; the timestamp is predictable. ULIDs are great IDs but poor secrets. Do not use a raw ULID as a session token, password reset link, or API key.
    • Relying on ordering across many machines to the millisecond. Sorting reflects each generator clock. Two servers with slightly different clocks can produce ULIDs that sort out of true order by a few milliseconds, so do not treat ULID order as a perfectly accurate global timeline.
    • Storing ULIDs in a case-sensitive way and comparing mixed case. ULIDs decode the same in upper or lower case, but if you store one row uppercase and another lowercase, a case-sensitive text comparison treats them as different. Normalise to one case before comparing or indexing.

    Glossary

    ULID
    Universally Unique Lexicographically Sortable Identifier, a 128-bit ID written as 26 base32 characters.
    Crockford base32
    A 32-symbol encoding using 0 to 9 and A to Z but skipping I, L, O and U to avoid confusion.
    Lexicographic sort
    Ordering strings character by character, like a dictionary. For ULIDs this matches creation-time order.
    Entropy
    The randomness in the last 80 bits of a ULID, which makes collisions within the same millisecond extremely unlikely.
    Monotonic
    A mode that guarantees each ULID in a batch is strictly greater than the previous one, even within one millisecond.

    Frequently asked questions

    What is a ULID?

    A ULID is a Universally Unique Lexicographically Sortable Identifier: a 128-bit ID written as 26 Crockford base32 characters. The first 10 characters are a millisecond timestamp and the last 16 are random, so ULIDs are unique like a UUID but also sort by the time they were created.

    How is a ULID different from a UUID?

    Both are 128 bits, but a UUID v4 is fully random and does not sort by time, while a ULID puts a timestamp first so plain text sorting matches creation order. A ULID is also shorter at 26 characters versus 36 for a dashed UUID, and uses base32 instead of hexadecimal.

    Are ULIDs guaranteed to be unique?

    Within a single millisecond, uniqueness comes from 80 random bits, giving over a trillion trillion possibilities, so collisions are astronomically unlikely. Across different milliseconds the timestamp differs, so those ULIDs cannot collide. The monotonic option removes even same-millisecond ties within one batch.

    Why are ULIDs sortable?

    The 48-bit timestamp sits at the front of the string and Crockford base32 preserves numeric order, so a later ULID is always greater as text than an earlier one. Sorting a list of ULIDs alphabetically therefore puts them in the order they were generated.

    Can I use a ULID as a database primary key?

    Yes, and it is a common choice. Because new ULIDs are larger than older ones, rows append near the end of a sorted index rather than scattering randomly like UUID v4, which keeps inserts efficient on large tables. They are also compact, URL-safe, and unique across machines.

    Is this ULID generator private and offline?

    Yes. Every ULID is built in your browser using the local clock and the browser crypto.getRandomValues source. Nothing is sent to a server, so the IDs never leave your device and the tool works without a network connection.