wtf is the default nanoid length
The default nanoid length is 21 characters.
This gives you about 126 bits of entropy, which provides excellent collision resistance - you'd need to generate around 2.8 trillion IDs to have a 1% chance of collision.
If you need shorter IDs, you can specify a custom length like nanoid(10)
, but 21 is the default when you just call nanoid()
without arguments.
Smart, efficient model for everyday use Learn more