Skip to main content
KalkuNet

NanoID and API Token Generator — Any Alphabet and Length

Create compact URL-safe NanoIDs & prefixed sk_live_ API keys cleanly.

Runs in your browserDeveloper · Cryptography, JWT, Keys & Identifiers
Alphabet:

64 characters × 21 positions = 126.0 bits of entropy.

  • Every character is equally likely: random bytes from crypto.getRandomValues are masked to the nearest power of two and values outside the alphabet are thrown away rather than taken modulo, so no character appears more often.
  • Prefixes such as sk_live_ or pk_test_ help secret scanners recognise leaked keys; they add no security.

When to use the Custom Alphabet NanoID & API Key Generator

  • Short tokens that are safe in URLs

    NanoID's default alphabet uses A–Z, a–z, 0–9, underscore and hyphen, so 21 characters already give 126 bits of entropy, as much as UUID v4 but shorter and safe in URLs.

  • The alphabet and prefix you need

    Pick hex, digits only, lower case, no look-alikes such as 0/O and 1/l/I for codes people type, or write your own alphabet. Prefixes such as sk_live_ help secret scanners recognise leaked keys.

  • How long until a duplicate appears

    Enter how many tokens you create an hour, and the tool works out when a 1% chance of any duplicate is reached by the birthday bound. Use that figure to choose a long enough token.

  • Every character equally likely

    Random bytes from crypto.getRandomValues are masked and values outside the alphabet are thrown away rather than taken modulo. A chi-square test on 200,000 characters per alphabet confirms no character comes up more often.

Frequently asked questions

How long should a token be?

For secret tokens, at least about 128 bits of entropy; with the default alphabet that is 22 characters.

Why are repeated characters refused?

A character that appears twice in the alphabet would be picked twice as often, lowering the entropy.

How is NanoID different from a UUID?

Both are random; NanoID is shorter and its alphabet can be changed, while a UUID has a fixed format that databases and many libraries recognise.

Are the tokens stored?

No. They are created in your browser and sent nowhere.

Learn more