ULID (Universally Unique Lexicographically Sortable Identifier) was created to solve the same problem as UUID v7: time-ordered unique identifiers without coordination. The two formats have nearly identical binary layouts but differ in encoding and standardization.
ULID structure
01ARZ3NDEKTSV4RRFFQ69G5FAV
|------||----------------|
10 chars 16 chars
timestamp random (80 bits)
Total: 26 Crockford Base32 characters = 128 bits
| Field | Bits | Characters |
|---|---|---|
| Timestamp | 48 | 10 (Crockford Base32) |
| Randomness | 80 | 16 (Crockford Base32) |
| Total | 128 | 26 |
UUID v7 structure
018fbe3a-4c5d-7b12-8f3e-1a2b3c4d5e6f
|---------| | | |------------|
48-bit ms ver rand rand (62 bits)
(12b)
Total: 36 chars (32 hex + 4 hyphens) = 128 bits
| Field | Bits |
|---|---|
| Timestamp | 48 |
| Version | 4 |
| Random A | 12 |
| Variant | 2 |
| Random B | 62 |
| Total random | 74 |
See UUID Bit Fields for the full layout.
Feature comparison
| Property | ULID | UUID v7 |
|---|---|---|
| Size (string) | 26 chars | 36 chars |
| Size (binary) | 16 bytes | 16 bytes |
| Timestamp bits | 48 | 48 |
| Random bits | 80 | 74 |
| Encoding | Crockford Base32 | Hex with hyphens |
| Standard | Community spec | RFC 9562 |
| DB UUID column | Requires conversion | Native |
| Case-sensitive | No | Conventionally lowercase |
| URL-safe | Yes | Yes (with hyphens) |
| Go built-in | No | Yes (1.24+) |
| .NET built-in | No | Yes (Guid.CreateVersion7, .NET 9+) |
ULID to UUID v7 conversion
Both formats are 128-bit, so conversion is lossless at the binary level:
import { ulid, decodeTime } from 'ulid';
import { v7 as uuidv7 } from 'uuid';
// ULID example
const id = ulid();
const ms = decodeTime(id); // extract Unix ms timestamp
// UUID v7 equivalent — same timestamp, different encoding
const id7 = uuidv7({ msecs: ms });
When to use ULID vs UUID v7
Prefer ULID when:
- You need a shorter display string (26 vs 36 chars)
- The codebase already uses ULID consistently
- You want case-insensitive identifiers
Prefer UUID v7 when:
- You want native database UUID column storage (16 bytes, not 26)
- You need RFC-standard format for compliance or interoperability
- You are using Go 1.24+, .NET 9+, or a modern ORM with built-in UUID v7 support
- You want the broadest library support across languages
Further reading
- Snowflake ID — 64-bit time-ordered IDs
- Sortable ID
- UUID v4 vs UUID v7
- UUID Bit Fields — Version and Variant
- What is a UUID
Frequently asked questions
What is a ULID?
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier combining a 48-bit Unix millisecond timestamp and 80 random bits, encoded as 26 Crockford Base32 characters (e.g. 01ARZ3NDEKTSV4RRFFQ69G5FAV). ULIDs are case-insensitive, URL-safe, and sort lexicographically in chronological order — the same properties as UUID v7. See Sortable ID.
What is the difference between ULID and UUID v7?
ULIDs and UUID v7 have identical bit layouts: 48-bit timestamp + random bits totaling 128 bits. The key differences are encoding (ULID uses 26 Base32 chars; UUID v7 uses 36 hyphenated hex chars) and standardization (UUID v7 is RFC 9562; ULID is a community spec). UUID v7 stores natively in database UUID columns (16 bytes); ULIDs are stored as TEXT (26 bytes) or require binary conversion. UUID v7 has broader native support in PostgreSQL, MySQL 8, and ORMs. See UUID v4 vs v7.
Should I use ULID or UUID v7 for new projects?
For new projects, UUID v7 is generally preferred because it is an IETF standard (RFC 9562), stores in native UUID database columns, is supported by all major ORMs and query builders, and is generated by built-in APIs in Go (1.24+) and .NET 9+. ULID is better if you specifically need the shorter 26-character display format or are adding to an existing ULID-based system. See What is a UUID.