All tools

NanoID Generator

Generate URL-safe NanoIDs.

IDs

    Bits of randomness per ID: 126

    ~50% collision after: 9.22e+18 IDs

    NanoID, designed by Andrey Sitnik. Uses crypto-strong random bytes and a constant-time mask. Default 21 characters give roughly the same uniqueness as a UUID v4 in 30% fewer characters.

    About

    NanoID is a smaller alternative to UUID. The default 21 character ID has the same uniqueness as UUID v4 in 30 percent fewer characters. Pick from URL-safe, alphanumeric, lowercase, no-ambiguous, or hex alphabets.

    How to use

    1. Pick the length.
    2. Pick an alphabet.
    3. Generate.

    FAQ

    How does it compare to UUID?+

    UUID v4 is 36 characters with hyphens, 122 random bits. NanoID 21 chars with the default alphabet is 126 random bits. Same uniqueness, smaller string.

    Is it cryptographically random?+

    Yes. Uses crypto.getRandomValues with a constant-time mask, designed to avoid the modulo bias in older ID generators.