UUID & ULID Generator · Tutorial
How to create sortable IDs for logs and files
5 min readbeginnerUpdated
When files or log entries are named with random IDs, a folder listing or a sorted key list is in no useful order. ULIDs fix this because their text order is their time order. You will generate a batch, check its order and decode a timestamp.
What you need
Steps
Generate a batch
Set How many to 5 with Keep in order within a millisecond ticked and press Generate new. The first ten characters are almost identical because they hold the current time.
Use them as names
Prefix file names or storage keys with a ULID. Any tool that sorts names alphabetically, from a file manager to an S3 listing, now shows the newest items last.
uploads/01K8ZR4BRG3W2Q8M7T5XN9VJ6P-invoice.pdf uploads/01K8ZR4BRG3W2Q8M7T5XN9VJ6Q-receipt.pngFind when something happened
Paste an ID from a log into Inspect a UUID or ULID. The tool shows the creation time in UTC and your local time, without needing the original record.
Pick a case and stick to it
ULIDs are case-insensitive, but mixing cases breaks plain text sorting, because lowercase letters sort after uppercase ones. Keep Uppercase ticked (the standard form) unless your system needs lowercase everywhere.
Try it yourself
Opens the UUID & ULID Generator with this tutorial's sample loaded.
Common mistakes
- Sorting ULIDs made on machines with wrong clocks
- The time part comes from the clock of the machine that made the ID. A server with a clock that is minutes off will produce IDs that sort in the wrong place.
- Treating the ID as a secret
- Anyone can read the time from a ULID, and IDs made close together are similar. Don’t use them as passwords or private links.
Next steps
Go back to the UUID & ULID Generator, or keep going with one of these:
FAQ
How many ULIDs can I make per millisecond?
In monotonic mode the 80-bit random part counts upwards, so far more than any system needs. The generator here makes up to 10,000 per batch.