Choose how many ULIDs to generate (1-1000)
Click "Generate ULIDs" to create sortable unique identifiers
Copy individual ULIDs or download all as a text file
ULID (Universally Unique Lexicographically Sortable Identifier) is a modern alternative to UUID that combines the benefits of unique identification with natural time-based sorting. A ULID is a 26-character string that encodes both a timestamp and random data, making it perfect for distributed systems and databases.
Unlike traditional UUIDs which are 36 characters long and randomly ordered, ULIDs are shorter (26 characters), naturally sortable by creation time, and use a Crockford Base32 encoding that's case-insensitive and URL-safe. This makes ULIDs ideal for use as database primary keys, API identifiers, and distributed system coordination.
A ULID consists of two parts:
ULIDs offer several advantages over traditional UUIDs:
| Feature | ULID | UUID v4 |
|---|---|---|
| Length | 26 characters | 36 characters |
| Sortable | Yes (by timestamp) | No (random) |
| Encoding | Crockford Base32 | Hexadecimal |
| Case-sensitive | No | No |
| URL-safe | Yes | Yes |
| Timestamp | Embedded | Not included |
Enter the number of ULIDs you need to generate in the quantity field. You can generate anywhere from 1 to 1000 ULIDs at once. For most applications, generating 5-10 ULIDs at a time is sufficient for testing and development purposes.
Click the "Generate ULIDs" button to create your unique identifiers. The generation happens instantly in your browser using cryptographically secure random number generation. Each ULID includes a timestamp component that shows exactly when it was created.
You can copy individual ULIDs by clicking on them, or download all generated ULIDs as a text file using the "Download" button. The downloaded file contains one ULID per line, making it easy to import into your application or database.
Each generated ULID is displayed with its decoded timestamp, showing you the exact millisecond when it was created. This timestamp information is useful for debugging and understanding the chronological order of your identifiers.
ULIDs make excellent primary keys for databases because they're naturally sortable by creation time. This improves database index performance compared to random UUIDs, as new records are always inserted at the end of the index rather than in random positions. The sortability also makes it easier to query records by creation order without needing a separate timestamp column.
In distributed systems where multiple servers need to generate unique identifiers independently, ULIDs provide a perfect solution. Each server can generate ULIDs without coordination, and the identifiers will still be globally unique and naturally ordered by creation time across all servers.
ULIDs are ideal for tracking API requests and responses. Their sortable nature makes it easy to trace request flows chronologically, and the embedded timestamp helps with debugging and log analysis. The shorter length compared to UUIDs also reduces payload sizes in API responses.
In event-sourced systems, ULIDs provide natural ordering of events without requiring additional timestamp fields. The embedded timestamp ensures events are always processed in the correct chronological order, even when generated across multiple nodes.
ULIDs work great for naming files and documents because they're URL-safe and sortable. Files named with ULIDs will automatically sort chronologically in file systems and cloud storage, making it easy to find recent files without checking metadata.
const { ulid } = require('ulid');
// Generate a single ULID
const id = ulid();
console.log(id); // 01ARZ3NDEKTSV4RRFFQ69G5FAV
// Generate with specific timestamp
const customId = ulid(1469918176385);
console.log(customId); // 01ARYZ6S41TSV4RRFFQ69G5FAV
from ulid import ULID
# Generate a new ULID
new_ulid = ULID()
print(str(new_ulid)) # 01ARZ3NDEKTSV4RRFFQ69G5FAV
# Parse existing ULID
parsed = ULID.from_str('01ARZ3NDEKTSV4RRFFQ69G5FAV')
print(parsed.timestamp()) # Get timestamp
CREATE TABLE users (
id CHAR(26) PRIMARY KEY,
email VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
-- Insert with ULID
INSERT INTO users (id, email)
VALUES ('01ARZ3NDEKTSV4RRFFQ69G5FAV', 'user@example.com');
{
"id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",
"type": "order",
"status": "pending",
"created": "2024-01-15T10:30:00Z"
}
const ulids = [ '01ARZ3NDEKTSV4RRFFQ69G5FAV', '01ARZ3NDEKTSV4RRFFQ69G5FAW', '01ARZ3NDEKTSV4RRFFQ69G5FAX' ]; // ULIDs are naturally sortable ulids.sort(); // Already in chronological order!
Explore our other unique identifier generators:
Get $200 free DigitalOcean credit or sponsor us on GitHub!