Who We Are

Retenvo is a global technology company creating innovative solutions and products for businesses. Retenvo provides a range of innovative and scalable tech product development, software development, website design, web application development, mobile application development, software as a service (SaaS), digital marketing, graphic design and corporate branding services to startup and large-scale businesses. .
[email protected]
+234 807 520 3034
+234 909 099 9970
+44 745 860 8942

ULID – Universally Unique Lexicographically Sortable Identifier

Retenvo > Uncategorised  > ULID – Universally Unique Lexicographically Sortable Identifier

ULID – Universally Unique Lexicographically Sortable Identifier

UUIDs are usually quite nice to use as random IDs. Most people including me would simply use a UUID v4 as a way to generate random IDs. But UUIDs v4 is just plain randomness. There is no way to tell if a uuid-a > uuid-b or the vice versa. That is when I discovered ULID. ULID stands for Universally unique Lexicographically sortable IDentifiers. ULID ensures that the IDs can be monotonically ordered and can be sorted even when generated within a millisecond. There are 2⁸⁰ possible ids within a millisecond.

If you thought that UUID was the end of universally unique identifiers, think again. Here’s the ULID spec, with the following improvements:

  • 128-bit compatibility with UUID
  • 1.21e+24 unique ULIDs per millisecond
  • Lexicographically sortable!
  • Canonically encoded as a 26 character string, as opposed to the 36 character UUID
  • Uses Crockford’s base32 for better efficiency and readability (5 bits per character)
  • Case insensitive
  • No special characters (URL safe)
  • Monotonic sort order (correctly detects and handles the same millisecond)

Here’s how it looks:


And there’s a wide selection of libraries implementing ULID for all major programming languages.