Fast, time-sortable, 21-character Base58 unique IDs you can actually read, copy, and work with. For JavaScript, Python, and Rust.
npm install sparkid Every SparkID packs a millisecond-precision timestamp, a monotonic counter, and cryptographic randomness into 21 Base58 characters.
Lexicographic string comparison preserves temporal order
Counter ensures strict ordering even at sub-millisecond throughput
~8.4 × 10²² unique values per millisecond from 13 Base58 characters of entropy
sparkid gives you the best of every world — compact, sortable, monotonic, fast, and with zero dependencies.
| sparkid | UUID v4 | UUID v7 | nanoid | ULID | |
|---|---|---|---|---|---|
| Length | 21 | 36 | 36 | 21 | 26 |
| Sortable | ✓ | ✗ | ✓ | ✗ | ✓ |
| Monotonic | ✓ | ✗ | Opt-in | ✗ | Opt-in |
| URL-safe | ✓ | ✗ | ✗ | ✓ | ✓ |
| Binary repr. | 16 bytes | 16 bytes | 16 bytes | ✗ | 16 bytes |
| Performance | Fastest | Moderate | Slow | Moderate | Slow |
Identical algorithm, idiomatic API. Pick your language and generate SparkIDs in one line.
import { generateId } from "sparkid";
const id = generateId();
// → "1ogVp65qEuNUygJHecWi9" Up to 23M SparkIDs/sec in Rust, 8M in JavaScript, 7.5M in Python. Faster than UUID, nanoid, and ULID in every language.
Base58 drops ambiguous characters — no 0/O,
no I/l. Double-click to select the whole ID.
Read it aloud without confusion. Copy it from a log on the first try.
Pack any SparkID into 16 bytes for efficient storage. Sort order is preserved — byte comparison matches string comparison.
Per-thread generators in Python and Rust. Python automatically
reseeds on fork() — no stale state in child processes.
JS and Python have no runtime dependencies at all. Rust depends
only on rand for the userspace CSPRNG.
Random bytes are rejection-sampled to Base58 — never modulo. Uniform distribution across the full output space.
Median throughput. Higher is better. sparkid leads in every language.
Median IDs/second · Higher is better · Run it yourself
Install sparkid in your language of choice and generate your first SparkID in seconds.