Numbers
Sortable Short ID Generator
Used by developers, writers, and creators worldwide.
A sortable short ID generator creates compact, alphanumeric identifiers with a base-36 timestamp baked into the front, so a plain alphabetical sort always returns records in creation order. No separate created_at column needed. Unlike 36-character UUIDs, these IDs stay short enough for URLs, filenames, and user-facing references. Set the random suffix length to balance uniqueness against ID size — 4 characters covers low-traffic prototypes, while 6 to 8 handles systems writing hundreds of records per second. Add an optional prefix like usr_, order_, or doc_ to namespace IDs by entity type, making them instantly readable in logs and error messages.
Loading usage…
Free forever — no account required
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Set the Count field to the number of IDs you need in one batch.
- Adjust Random Suffix Length — use 4 for quick tests, 6 or more for production-like output.
- Type an optional prefix (e.g. order_, usr_) to namespace IDs by entity type.
- Click Generate to produce the full list of sortable IDs.
- Copy individual IDs or the entire list and paste them into your database seed file, code, or spreadsheet.
Use Cases
- •Pre-generating 500 order IDs before a bulk insert into a Postgres staging table
- •Creating URL slugs for a Next.js blog so newest posts sort first without an ORDER BY query
- •Namespacing user and payment records with usr_ and pay_ prefixes in a multi-tenant Supabase schema
- •Seeding Cypress fixtures with time-ordered record IDs that reflect a realistic creation sequence
- •Naming S3-uploaded assets so an alphabetical directory listing stays chronologically sorted
Tips
- →Match your prefix to your database table name (e.g. inv_ for invoices) so IDs self-document in logs.
- →If you plan to index these IDs in a database, keep total length under 16 characters to fit common VARCHAR constraints cleanly.
- →Generate a batch larger than you need for a seed file — having spare IDs avoids re-running the tool mid-import.
- →Avoid uppercase letters in your prefix; base-36 output is lowercase, and mixed case breaks lexicographic sort order.
- →Test sort behaviour by generating two batches a few seconds apart and confirming the earlier batch's IDs alphabetically precede the later ones.
FAQ
how do sortable short IDs sort chronologically without a timestamp column
The millisecond timestamp is base-36 encoded and placed at the start of every ID. Because base-36 digits sort lexicographically in the same order they sort numerically, a plain alphabetical sort on any list of these IDs returns them in creation order. That means you can skip the ORDER BY created_at in many simple queries.
are sortable short IDs unique enough to use as primary keys
For low-to-moderate traffic they work well — the timestamp separates IDs created in different milliseconds, and the random suffix handles same-millisecond collisions. A 6-character suffix gives 36^6 (about 2.2 billion) possible values per millisecond, which covers most production workloads. For systems generating thousands of records per millisecond, use a standardised library like ULID or KSUID instead.
what is the difference between a sortable short ID and a ULID
A ULID is a 26-character standardised format with library support across most languages and a defined binary layout. Sortable short IDs are shorter by default, support custom prefixes, and are easier to read aloud or reference in support tickets. The trade-off is no cross-platform spec — if interoperability between services in different languages matters, ULID is the safer choice.