ULID Generator
Generate sortable, time-ordered ULID identifiers, with optional monotonic mode. Runs entirely in your browser. Nothing is sent to any server.
Identifiers created in the same millisecond keep increasing, so a batch stays in generation order.
Generated ULIDs appear here
What is a ULID?
A ULID is a 128-bit identifier, the same size as a UUID, written as 26 characters instead of 36. Its first 48 bits are the creation time in milliseconds and the remaining 80 are random, so sorting ULIDs as plain strings sorts them by creation time. The encoding is Crockford Base32, which leaves out I, L, O and U: that avoids both the digit/letter confusions when a human reads one out, and the chance of an identifier spelling something unfortunate. Everything is generated in your browser using its cryptographic random source.
How the 26 characters are laid out
Milliseconds since the Unix epoch, big-endian. This is what makes ULIDs sort chronologically, and it's readable: the tool decodes it back for every value it generates.
Random bits from the browser's cryptographic generator. With monotonic mode on, these are incremented rather than redrawn within a single millisecond, which keeps a batch in order.
Examples
Generating ULIDs in the languages you're most likely to reach for:
import { ulid } from "ulid";
ulid(); // 01ARZ3NDEKTSV4RRFFQ69G5FAVimport ulid
ulid.new().strimport com.github.f4b6a3.ulid.UlidCreator;
UlidCreator.getMonotonicUlid().toString();import "github.com/oklog/ulid/v2"
ulid.Make().String()use Ulid\Ulid;
Ulid::generate();-- store as a 16-byte value, not text
CREATE TABLE orders (id bytea PRIMARY KEY);Use Cases
Primary keys that don't fragment the index
Random UUIDs land all over a B-tree index, so every insert dirties a different page. ULIDs are time-ordered, so inserts append near the end of the index, which is why they behave much better as primary keys at volume.
Ordering events without a separate timestamp column
Because the time is embedded in the value, log lines, events and messages sort correctly by id alone, even when they arrive out of order or from different machines.
Identifiers that appear in URLs or get read aloud
26 characters instead of 36, no hyphens, and no I/L/O/U to confuse with 1/0. That makes ULIDs meaningfully easier to paste into a URL, print on a label or dictate over a phone call.
Ids generated on the client
Like UUIDs, ULIDs don't need coordination: a browser, a mobile app or an offline worker can mint one without asking a server, and it stays unique when the data syncs back.