Zero Signup ToolsFree browser tools

Generator Tools

KSUID Generator

Generate K-Sortable Unique Identifiers (KSUID) in your browser. 27-character base62, decode the embedded timestamp and 128-bit payload. No signup.

KSUID generator and decoder

Generated KSUIDs (0)

Click Generate KSUIDs to produce a batch. Each ID is a 27-character base62 string that sorts in time order when compared as plain text.

Decode a KSUID

Paste a 27-character KSUID to recover the embedded timestamp, ISO date, and the 16-byte random payload.

Paste a KSUID above to see its decoded fields.

KSUID anatomy

  • Length: 160 bits total. 32 bits of timestamp at the front, 128 bits of random payload after.
  • Epoch: Unix-second 1,400,000,000 ( 2014-05-13T16:53:20Z). The offset keeps the 4-byte timestamp field useful until the year 2150.
  • Wire format: 27 base62 characters using the alphabet 0-9, A-Z, a-z. The encoding is straight base conversion and pads to 27 with the zero character (0), so the nil value is 27 zeros.
  • Sortability: because the timestamp lives in the high-order bytes and base62 preserves order on left-padded strings of equal length, KSUIDs sort by creation time when compared as text.
  • Collision: 128 bits of randomness per second is the same security budget as UUID v4; collisions within the same second are computationally infeasible.

KSUID vs UUID, ULID, and Snowflake

  • vs UUID v4: KSUIDs are shorter on the wire (27 vs 36 chars), URL-safe without escaping, and time-sortable. UUID v4 is not sortable.
  • vs UUID v7: both are time-sortable. UUID v7 encodes milliseconds (RFC 9562), KSUID encodes seconds. UUID v7 has the broader standard now; KSUID predates it and remains the canonical choice in the Segment, Stripe, and Go ecosystems.
  • vs ULID: ULID is 26 characters of Crockford Base32 with millisecond precision and 80 bits of randomness. KSUID is one character longer, uses base62, has second precision, and 128 bits of randomness.
  • vs Snowflake: Snowflake IDs are 64-bit integers carrying machine and sequence fields. KSUIDs are 160-bit values with a single payload, so two independent generators cannot collide without coordination.

How to use

  1. Pick how many KSUIDs to generate (1 to 500) and choose Current time to stamp each ID with the wall-clock second, or Custom date and time to key the batch to a specific moment.
  2. Click Generate KSUIDs. Each row shows the 27-character base62 string and the ISO timestamp it carries; use the per-row Copy button or Copy all to take the whole list.
  3. To inspect an existing KSUID, paste it into the Decode a KSUID box. The decoder shows the embedded timestamp, ISO date, the 16-byte random payload as hex, and the full 20-byte binary.
  4. Use the Segment example, Nil KSUID, and Max KSUID sample buttons to see what valid edge values look like before pasting your own.
  5. Click Restore defaults to return the batch size and timestamp source to their starting values.

About this tool

KSUID Generator and Decoder produces and parses K-Sortable Unique Identifiers in your browser, following the public Segment KSUID specification. A KSUID is a 160-bit value laid out as a 4-byte big-endian uint32 timestamp followed by a 16-byte random payload from crypto.getRandomValues, the same CSPRNG that backs crypto.randomUUID and SubtleCrypto in modern browsers. The timestamp is the number of seconds since the KSUID epoch, Unix-second 1400000000 (Tue May 13 2014 16:53:20 UTC), so the 4-byte field remains useful until the year 2150. Serialized form is exactly 27 characters of base62, drawn from the alphabet 0-9, A-Z, a-z, left-padded with the base62 zero character so every encoded value is the same length. Because the timestamp sits in the high-order bytes and base62 preserves order on equal-length strings, plain string comparison sorts KSUIDs by creation time, which makes them excellent database primary keys, event identifiers, idempotency tokens, log correlation IDs, and S3 object keys. Generate a single KSUID, a batch of up to 500, or a batch keyed to a custom date and time for sortable test fixtures, then copy any single ID, the full list, or just the encoded portion. The built-in decoder reverses the encoding and surfaces the embedded Unix-second value, the ISO 8601 string, the KSUID seconds (seconds since the KSUID epoch), the 16-byte random payload in lowercase hexadecimal, and the full 20-byte binary in hexadecimal, with exact error messages and the failing character index when a value is the wrong length, contains whitespace, or uses an alphabet character outside the base62 set. The Segment example KSUID, the all-zero nil KSUID, and the maximum representable KSUID are one click away as samples. Useful for debugging KSUIDs that show up in production logs, producing realistic seed data, comparing KSUIDs against UUID v4, UUID v7, ULID, NanoID, and Snowflake when choosing a primary key strategy, and shipping a quick test value into a Postgres or DynamoDB key column. Everything runs locally on your device; the KSUIDs you generate and any value you paste into the decoder never leave your browser.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsGenerator Tools