ULID Generator

ULIDs generated—
Characters each—
Format—

How ULID Generator is calculated: ULID = 48 bits of millisecond timestamp in Crockford Base32 (10 chars) + 80 bits of randomness (16 chars). 26 characters, time-sortable.

What is a ULID generator?

A ULID generator creates Universally Unique Lexicographically Sortable Identifiers — 26-character ids that sort in the order they were created. A ULID is 10 characters of timestamp followed by 16 characters of randomness, all in Crockford Base32, which uses digits and letters but skips I, L, O, and U to avoid confusion. The default here generates 1 ULID of 26 characters.

ULIDs solve the problem UUIDs have: UUIDs are unique but they do not sort by time. A database table keyed by UUID version 4 has its newest rows scattered randomly, which makes range queries and pagination awkward. A table keyed by ULID has its newest rows at the end, because the timestamp comes first.

This tool generates ULIDs in your browser, using the current time and the browser's secure random source. Nothing is uploaded, nothing is stored, and each ULID is unique: the timestamp gives the millisecond, and the randomness makes two ULIDs in the same millisecond different.

How a ULID works

A ULID has two parts. The first 10 characters encode the current time in milliseconds since the Unix epoch, in Crockford Base32. Ten Base32 characters hold 50 bits, which is enough for the timestamp — the first ULID timestamp, 01ARZ3NDEKTSV4RRFFQ69G5FA, is a real ULID from the specification's examples.

The second 16 characters are 80 bits of randomness, also in Crockford Base32. They make the ULID unique within a millisecond: two ULIDs created in the same millisecond differ in these 16 characters. The randomness comes from the browser's crypto.getRandomValues, which is a secure source, with Math.random as a fallback.

Crockford Base32 is the alphabet: the digits 0-9 and the letters A-Z except I, L, O, and U. I and L are skipped because they look like 1, O is skipped because it looks like 0, and U is skipped because it is used for profanity filtering in some systems. The result is an id that is safe to read aloud and to type.

Time-sortable: the point of a ULID

Sorting is the reason ULIDs exist. Because the timestamp is the first part and Base32 sorts lexicographically, sorting ULIDs as strings gives the order they were created in. A database can use a ULID as its primary key and get time-ordered rows without a separate created-at column.

The sort is by millisecond, not by exact order. Two ULIDs created in the same millisecond sort by their random part, which is random — so within a millisecond, the order is arbitrary. For most uses that is fine: the millisecond is the unit that matters, and ties inside it are rare and harmless.

The timestamp also makes a ULID readable. The first 10 characters decode to a date and time, so a ULID in a log tells you when the record was created without a lookup. A UUID version 4 carries no such information, which is why teams that need time-ordered ids are moving to ULIDs or to UUID version 7.

The Crockford alphabet is the 32 characters the ULID uses for its random part, and it was chosen to be readable. It uses the digits 0 to 9 and the letters A to Z except for I, L, O, and U, which are left out because they look like digits or each other — I looks like 1, L looks like 1, O looks like 0, and U looks like V. The result is a string that can be read aloud and typed by hand without confusion, which is the point: an identifier that a human must sometimes read should not contain characters that a human misreads.

A worked example: generating ULIDs

Press Generate ULID with the default of 1 and you get one ULID of 26 characters — 10 characters of timestamp and 16 of randomness. Generate again a second later and the first 10 characters will have changed, because the timestamp moved on, while the last 16 are random each time.

Generate 10 at once and the list is in creation order: the first 10 characters are the same or nearly the same for all ten, because they were made in the same millisecond, and the last 16 differ. Sort the list as strings and it stays in the same order, which is the property that makes ULIDs useful as database keys.

Compare with a UUID version 4: a UUID is 36 characters with dashes, and it carries no time. A ULID is 26 characters with no dashes, and it carries the creation time. The ULID is shorter, sortable, and readable — which is why new systems are choosing it.

Who uses a ULID generator, and why

Developers building new systems are the main users. A database that needs unique, time-ordered ids — for events, orders, messages, or logs — gets them from ULIDs without a separate timestamp column. The id is the timestamp and the uniqueness in one value.

API developers are the second group. An API that returns ids that sort by creation time makes pagination simple: the next page starts after the last id seen. A ULID gives that ordering for free, while a UUID version 4 does not.

Anyone who needs test data is a third group. A test that creates records needs ids, and a ULID generator produces them in bulk. A UUID generator makes the older format, while this tool makes the newer one.

API developers are a third group. An API that returns a list of records in time order needs ids that sort the same way the records were created, and a ULID does that without a separate timestamp field. The generator is the tool for testing that behaviour: generate a batch, sort them as strings, and the order should match the order they were made. A UUID cannot do that, because its random part has no time in it, and the list would come back in random order.

ULID vs UUID

A ULID is shorter, sortable, and time-readable; a UUID is the older standard with wider support. The UUID generator on this site makes version 4 UUIDs, which are 36 characters with dashes and carry no time. A ULID is 26 characters with no dashes and carries the creation time in its first 10 characters.

The trade-off is support. UUIDs are built into every database and every language, while ULIDs need a library in most languages — though the format is simple enough to implement by hand, and most ecosystems now have one. For a new system, ULIDs are the better choice; for an old system, UUIDs are the safer one.

UUID version 7 is the middle ground: a UUID that is time-ordered like a ULID, in the UUID format. If a system requires UUIDs but needs time ordering, version 7 is the answer. If a system stores ids in lowercase, a case converter can normalise the case of a whole list at once.

A ULID is not a UUID, and the distinction matters when the system expects one or the other. A UUID is 36 characters with hyphens, and a ULID is 26 characters with no hyphens, so a system that validates UUIDs will reject a ULID, and a system that expects ULIDs will reject a UUID. The two are both identifiers, but they are different formats, and the choice must match what the database or the API expects. Use the generator for ULIDs and the UUID generator for UUIDs — the two tools make different things.

Common ULID mistakes

The first mistake is treating a ULID as a secret. A ULID is an identifier, not a password: its timestamp is public, and its randomness is only 80 bits. Never use a ULID as an API key or a token — use a proper random secret for that, from a password generator or your language's secure random source.

Second: assuming ULIDs are unique across systems without randomness. Two systems that generate ULIDs in the same millisecond with a weak random source can collide. The browser's crypto.getRandomValues is a strong source, which is what this tool uses — but a system with a bad random source needs a different design.

Third: lowercase ULIDs in a case-sensitive store. The standard is uppercase, and this tool generates uppercase by default. Lowercase is offered for systems that store ids in lowercase, but mixing cases in one store creates two different ids for the same record.

Fourth: using ULIDs where a UUID is required. Some systems validate ids as UUIDs and reject anything else. Check what the system expects before switching formats — a ULID is not a UUID, and a UUID validator will report it as invalid.

A second mistake is assuming that two ULIDs generated in the same millisecond are different. They usually are, because the random part is 80 bits, but the same-millisecond case is the one place where a ULID can collide — two ULIDs made in the same millisecond from the same random source are still random, so a collision is unlikely but not impossible. The generator uses the browser's secure random source, which makes a collision as unlikely as the mathematics allows, but a ULID is still an identifier, not a guarantee of uniqueness.

How to use this ULID generator

Pick how many ULIDs you want — the default is 1 — and pick the letter case. Uppercase is the standard. Press Generate ULID, and your ULIDs appear in the box below, each 26 characters long.

To copy them, use the Copy button next to the output box. To generate more, press the button again — each press uses the current time, so the new ULIDs sort after the old ones. To check a UUID instead, use the UUID validator.

Everything runs in your browser. No sign-up, no account, no data sent anywhere. It works offline once the page has loaded. Generate a few ULIDs now and sort them as strings — the order they were created in is the order they sort in.

Press generate to make a ULID, and press it again for another — each press uses the current time and fresh randomness, so the ULIDs come out in time order. The output shows the ULID with its timestamp part and its random part, and the count tells you how many were made. To make many at once, use the count box, which produces a batch in order. Copy one or copy the batch, and paste them wherever the ids belong — a database, a test, or a list of records.

Frequently Asked Questions

A Universally Unique Lexicographically Sortable Identifier: 26 characters in Crockford Base32. The first 10 characters encode the creation time in milliseconds, and the last 16 are random. ULIDs sort in creation order, which UUIDs do not.

A ULID is 26 characters with no dashes and carries its creation time, so it sorts by time. A UUID version 4 is 36 characters with dashes and carries no time. ULIDs are the better choice for new systems that need time-ordered ids; UUIDs have wider support in older systems.

I and L are skipped because they look like the digit 1, O is skipped because it looks like 0, and U is skipped to avoid accidental profanity in generated ids. The result is an id that is safe to read aloud and to type.

No. A ULID is an identifier, not a secret — its timestamp is public and its randomness is only 80 bits. Use a proper random secret for passwords and keys, from a password generator or your language's secure random source.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.