UUID v4 vs UUID v7 vs ULID: choosing an identifier
Compare random and time-based identifiers, encoded timestamps and the limits of chronological sorting.
Maintained by Toolbench · Updated 10 October 2026
Choose according to your storage and API contract
UUID v4 uses random bits and does not encode creation time. It is widely recognized by UUID storage types and libraries. UUID v7 retains the UUID format while placing a Unix millisecond timestamp before its random bits.
ULID uses a compact 26-character Crockford Base32 representation with a timestamp and random portion. Its text sorts by time, but ULID is not a UUID string. Check your database column type and existing API expectations before replacing an identifier format.
Understand what time sorting guarantees
A time prefix can group newly inserted values more closely than purely random identifiers. The actual effect on database indexes depends on the engine, comparator, workload and storage representation; benchmark with your own data rather than assuming an automatic performance improvement.
Toolbench’s UUID v7 and ULID generators use random bits and do not implement a monotonic counter. IDs generated in the same millisecond can sort in a different order from generation. Clock skew between machines also prevents a strict global event order.
Treat timestamps as visible metadata
UUID v7 and ULID expose their encoded creation time. Timestamp inspection helps with debugging fixtures and records, but it cannot prove when a remote event occurred. A caller can construct an identifier with a different time.
None of these identifiers replaces an authorization check. A random or sortable ID can identify a record without granting permission to access it. Avoid using a time-encoded ID as a password or authentication token.
Validate and test the complete workflow
Use the UUID validator for UUID syntax and the dedicated inspector for a UUID v7 or ULID timestamp. ULID excludes I, L, O and U and requires a first character between 0 and 7. Confirm the representation survives serialization, logs, imports and database round trips.
For batch fixtures, download one identifier per line. If those fixtures drive scheduled events, preview the cron schedule in the deployment timezone separately; identifier time and scheduled execution time serve different purposes.