KSUID Decoder
Read the timestamp and payload out of a KSUID. Free, and runs entirely in your browser — nothing you enter is uploaded, stored or sent to a server.
About KSUID Generator
KSUID is Segment's answer to the same question ULID answers: an identifier that sorts by the time it was made. Twenty bytes — four of seconds, sixteen of randomness — written as exactly 27 characters of base62, so it is alphanumeric and needs no escaping anywhere.
The trade against ULID is one character for a great deal of randomness. ULID carries 80 random bits inside each millisecond; KSUID carries 128 inside each second. For anything generating identifiers in bulk from many machines at once, that is the more comfortable number by a wide margin.
The cost is resolution. The timestamp is a second, not a millisecond, so identifiers created inside the same second sort arbitrarily among themselves. If the ordering has to be exact at finer than a second, ULID or UUID v7 is the one to reach for.
Its epoch is 2014-05-13T16:53:20Z rather than 1970, chosen so the seconds fit in four bytes until 2150. That is worth knowing because it is the classic way to decode one wrongly: assume the Unix epoch and every date comes out forty-four years early, while the identifiers still sort and still round-trip.
Where it helps
- 128 random bits inside every second — far more headroom than ULID, for one extra character.
- Sorts lexicographically in creation order, so inserts stay at the hot end of the index.
- Alphanumeric base62: no dashes, no underscores, safe in a URL, a filename or a shell argument.
- Decodes back to the second it was made, with no key and no lookup.
- Uses Segment's own epoch, so decoded dates are the dates the reference implementation gives.
Limits
- One-second resolution: identifiers made in the same second have no defined order between them.
- The creation time is public in every identifier, which is the trade every sortable format makes.
- Twenty-seven characters is longer than a Nano ID and only a little shorter than a UUID's 36.
- It cannot represent a time before May 2014, because its epoch starts there.
Frequently asked questions
KSUID or ULID?
Randomness against resolution. KSUID gives 128 bits per second, ULID gives 80 per millisecond. If many machines generate in bursts, KSUID has more room; if the order inside a second matters, ULID has finer teeth.
Why did my decoder say 1970-something?
It assumed the Unix epoch. KSUID counts from 13 May 2014, so a decoder using 1970 reports a date forty-four years early while everything else about the identifier looks correct. It is the single most common KSUID bug.
Is the payload safe to treat as random?
Yes — it is sixteen bytes from the platform's cryptographic random source, with nothing derived from the machine or the process.
Related tools
- ULID / CUID Generator — Sortable, collision-resistant identifiers — and the timestamp inside one
- UUID Generator — UUID v1 to v7 — generate any version, or read what one encodes
- Nano ID Generator — Short, URL-safe random identifiers — and what the length actually buys
- TypeID Generator — Type-prefixed identifiers over UUID v7, readable and still a UUID underneath
- ObjectID Generator — MongoDB's twelve bytes — a timestamp, a process value and a counter
- Barcode Generator — Draw QR, Data Matrix, Code 128, EAN and more as SVG
More Generators tools
- UUID Generator — UUID v1 to v7 — generate any version, or read what one encodes
- ULID / CUID Generator — Sortable, collision-resistant identifiers — and the timestamp inside one
- Nano ID Generator — Short, URL-safe random identifiers — and what the length actually buys
- KSUID Generator — Sortable 27-character identifiers with a second of time and 128 bits of randomness
- TypeID Generator — Type-prefixed identifiers over UUID v7, readable and still a UUID underneath
- ObjectID Generator — MongoDB's twelve bytes — a timestamp, a process value and a counter
- Barcode Generator — Draw QR, Data Matrix, Code 128, EAN and more as SVG
- QR Code Generator — Create scannable QR codes as SVG
- UPI QR Code Generator — Make a UPI payment QR code that any UPI app can scan to pay you
- Diagram Studio — Draw architecture, sequence, ER, C4, network and nine other diagrams by dragging shapes and connecting them
- Random String — Random identifiers from a chosen alphabet
- Lorem Ipsum — Placeholder paragraphs, sentences or words
- Fake Data — Synthetic people and companies as JSON, CSV or SQL
- Random Number Generator — Draw uniformly random integers or decimals in a range, with or without repeats