ULID Generator
Generate a random Universally Unique Lexicographically Sortable Identifier (ULID). All operations are performed locally in your browser.
ULID is a 26-character, universally unique, lexicographically sortable identifier. Click "Generate" to create a new ULID.
ULID Generator
Universally Unique Lexicographically Sortable Identifier
Generated
1
Length
26 chars
Timestamp
48-bit
Random
80-bit
1
ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier that combines a 48-bit timestamp with 80 bits of randomness, encoded in Crockford's Base32.
Sortable
Lexicographically
128-bit
Same as UUID
Case Insensitive
Base32 encoded
URL Safe
No special chars
About ULID
ULID (Universally Unique Lexicographically Sortable Identifier) is a 26-character string that combines a timestamp with random data. It provides a way to generate unique identifiers that are both time-ordered and URL-safe.
Key features of ULID:
- Time-ordered: ULIDs are sortable by creation time
- URL-safe: Contains only URL-safe characters
- Case-insensitive: Can be safely used in case-insensitive contexts
- Monotonically increasing: Each new ULID is guaranteed to be greater than the previous one
ULID Structure
A ULID consists of two parts:
ULID = [Timestamp (10 chars)] + [Randomness (16 chars)]
Where:
Timestamp = 48-bit timestamp in milliseconds
Randomness = 80-bit random number
| Component | Size (bits) | Characters | Purpose |
|---|---|---|---|
| Timestamp | 48 | 10 | Millisecond precision time ordering |
| Randomness | 80 | 16 | Uniqueness guarantee |
ULID Implementation in Different Languages
JavaScript:
import { ulid } from 'ulid';
// Generate a new ULID
const id = ulid();
// Example: '01ARZ3NDEKTSV4RRFFQ69G5FAV'
Python:
import ulid
# Generate a new ULID
id = ulid.new()
# Example: '01ARZ3NDEKTSV4RRFFQ69G5FAV'
Common ULID Use Cases
- Database Primary Keys - Perfect for distributed databases where sorting by creation time is important
- Event Tracking - Track events in chronological order with guaranteed uniqueness
- Message Queues - Order messages while maintaining uniqueness
- Cache Keys - Generate unique cache keys that are sortable by creation time
- Session IDs - Create unique session identifiers that are URL-safe