ULID Generator
Generate valid ULIDs, which are sortable and unique.
-ℹ️ How ULIDs Work
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier that is unique and can be sorted chronologically. It is composed of two parts:
- Timestamp (48 bits): The first 48 bits represent the Unix time in milliseconds, ensuring chronological order.
- Randomness (80 bits): The remaining 80 bits are generated randomly, ensuring uniqueness even for ULIDs created in the same millisecond.
This combination makes ULIDs an excellent alternative to UUIDs, especially when chronological sorting of identifiers is important.
💡 When to Use ULID instead of UUID
ULID is particularly useful in scenarios where UUIDs might fall short:
- Database Primary Keys: In databases like PostgreSQL or MySQL, using sortable identifiers like ULID or UUIDv7 can significantly improve index performance, as new records are inserted in a mostly sequential order, reducing page splits and fragmentation.
- Event Sourcing and Logs: When recording events or logs, having identifiers that are naturally sorted by time simplifies queries and data analysis, without needing an extra `created_at` column for sorting.
Official Documentation
For more technical details, visit the official ULID specification on GitHub: ULID Specification.
⚠️ Usage Notice
The generated ULIDs are for development and testing purposes. Do not use them for fraudulent or illegal purposes.
Facts about the ULID Generator
- The ULID Generator creates 26-character identifiers in Crockford Base32.
- ULIDs are chronologically sortable by their timestamp prefix.
- Generation is performed in the browser, with no data being sent.
- ULIDs have 48 bits of timestamp and 80 bits of randomness.