How it works
Three kinds of identifier
A UUID v4 is 128 bits: 122 of them random, 4 fixed to the version number 4 and 2 fixed to the variant, as RFC 9562 lays out. Two v4s colliding is so unlikely that you can treat them as unique.
A UUID v7 starts with the current Unix time in milliseconds (48 bits), then the version and variant, then 74 random bits. Because the time comes first, v7s sort in the order they were made, which keeps database indexes tidy.
A Nano ID is 21 characters from a 64-letter, URL-safe alphabet (A–Z, a–z, 0–9, _ and -), about 126 random bits in a shorter string.
UUID = 32 hex digits = 128 bits; Nano ID = 21 × 6 bits = 126 bits
Where the randomness comes from
Every random bit comes from the browser’s crypto.getRandomValues, the same generator used for keys. For Nano IDs each byte is reduced modulo 64; since 64 divides 256 exactly, every letter is equally likely.
Reading the picture
Pick any row to see it drawn bit by bit: four squares under each hex digit (six under each Nano ID letter), filled for 1 and empty for 0. The version and variant bits are ringed, the v7 time bits are dark, and the random bits are lighter. For a v7 the time inside is read back as an ISO date.




