Skip to content
shortuuid

About

shortuuid was created and is maintained by the YouTube channel The Seasoned Programmer. Questions or suggestions? Email info@the-seasoned-programmer.com.

Everything on this site runs in your browser: the conversions use JavaScript's BigInt, and sample IDs come from crypto.getRandomValues, the same secure random number generator browsers use for encryption keys. Nothing you paste is sent to a server.

What is a short UUID?

A UUID is a 128-bit number, usually written as 32 hex digits and 4 hyphens: 36 characters. Hex uses only 16 symbols, so each character carries 4 bits. Write the same number with 58, 62 or 64 symbols and each character carries almost 6 bits, so 22 characters are enough. Nothing is lost or added: the short form decodes back to the same UUID, with the same uniqueness. It's a different way of writing the number, like 255 and ff.

Which encoding should I use?

Whichever you choose, write the alphabet down next to your API, because Base62 and Base58 libraries don't all agree. The code examples give the same output in four languages.

How long should a random ID be?

Long enough that a duplicate is out of the question for the number of IDs you'll ever make. A UUID v4 has 122 random bits: at a billion IDs a second, it takes 86 years to reach a 50% chance of one duplicate. Shorter IDs are fine for smaller systems, but the margin shrinks faster than intuition suggests, because of the birthday paradox. The collision calculator shows exactly how fast.

Standards

40+ years of programming experience, with a passion for programming and technology.