toolqik

08 · Generators

ULID Generator

Sortable, URL-safe unique IDs with a built-in timestamp, plus a decoder.

Runs in your browser
Options
ULIDs

    Decode a ULID

    About this tool

    A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit ID like 01JD3Z8K6W2Q5X7N9R4T0V1B8C. Its first 10 characters encode the creation time in milliseconds and the last 16 are random, so ULIDs are as unique as a UUID but sort by creation time as plain text. That makes them excellent primary keys: new rows land at the end of the index instead of at random places.

    How to use it

    1. Choose how many ULIDs you need and click Generate (or press G).
    2. Keep Monotonic order on so IDs created in the same millisecond still sort in the order they were made.
    3. Paste any ULID into Decode a ULID to see its creation date and time.

    ULID structure

     01JD3Z8K6W      2Q5X7N9R4T0V1B8C
    |----------|    |----------------|
     timestamp           randomness
      48 bits              80 bits
     10 chars             16 chars

    ULIDs use Crockford’s Base32 alphabet (0–9 and A–Z without I, L, O and U), so they are case-insensitive, contain no look-alike characters and are safe in URLs and file names. The timestamp runs out in the year 10889.

    ULID vs UUID

    ULIDUUID v4UUID v7
    Length as text26 characters36 characters36 characters
    Sorts by timeYesNoYes
    Random bits8012262–74
    Native database typeText, or convert to uuiduuiduuid

    If your database has a native UUID type, UUID v7 gives the same time ordering in a standard format. ULIDs win when you want shorter, friendlier IDs in URLs and logs.

    ULIDs in code

    // npm install ulid
    import { ulid, monotonicFactory } from 'ulid';
    
    ulid();                       // 01JD3Z8K6W2Q5X7N9R4T0V1B8C
    const next = monotonicFactory();
    next(); next();               // strictly increasing, even in the same ms

    The creation time inside a ULID is readable by anyone who sees the ID. Don’t use ULIDs where revealing when a record was created matters.

    FAQ

    What is a ULID?

    A 128-bit unique identifier written as 26 characters: a 48-bit millisecond timestamp followed by 80 random bits. ULIDs sort in creation order as plain text.

    Is a ULID better than a UUID?

    For database keys, a ULID’s time ordering keeps indexes compact and inserts fast, unlike UUID v4. UUID v7 offers the same benefit in standard UUID format.

    Can I get the creation time from a ULID?

    Yes. The first 10 characters are the timestamp. Paste a ULID into the decoder above to see it.

    What does monotonic mean?

    When several ULIDs are created in the same millisecond, the random part is incremented instead of re-drawn, so they still sort in creation order.

    Are ULIDs case-sensitive?

    No. Crockford Base32 treats upper and lower case the same; uppercase is the canonical form.

    esc
    ↑↓ navigate↵ open