Random Token Generator

Make random tokens for API keys, session secrets, test data or invite codes. Pick a format and length, add a prefix if you like, and see how many bits of randomness you get.

Free, no sign-up. Made in your browser with secure random numbers; nothing is sent or saved.

Token options

Bytes of randomness for hex and Base64 (8 to 128), characters for the others (8 to 256).

1 to 50.

Letters, digits, dot, dash or underscore. It adds no randomness.

Only used with "My own alphabet". Repeated characters and spaces are ignored; use 2 to 128 different characters.

Press Generate to make a token.

How to

Make a token in three steps

  1. Pick a format

    Hex and Base64URL suit API keys and secrets. Digits only suits short codes. Your own alphabet lets you avoid look-alike characters.

  2. Set the length

    For secrets, 16 bytes (128 bits) is a common minimum. The tool shows the bits of randomness for whatever you choose.

  3. Generate and copy

    Add a prefix if your system uses one, press Generate and copy the result into your secrets store.

Handling secrets

  • Store tokens in a secrets manager or environment variable, never in code or a public repository.
  • Use a different token for every service and rotate any token that may have leaked.
  • A token is only as safe as where it is kept. Do not send it by email or chat.
  • For human-typed codes, avoid look-alike characters by writing your own alphabet without 0, O, 1, l and I.

FAQ

Token generator questions

Are the tokens really random?

Yes. They come from your browser secure random generator (crypto.getRandomValues). Characters are picked without bias, so every symbol is equally likely.

Is a token sent to a server or saved?

No. Tokens are made on your device and are not sent, stored or placed in the address.

How long should a token be?

16 bytes (128 bits) is a common minimum for secrets that must be hard to guess. Shorter values are fine only for codes that expire quickly or are rate limited.

What is the difference between Base64 and Base64URL?

Base64URL swaps + and / for – and _ and drops padding, so it can sit in URLs and file names without escaping.

Why does length mean bytes for hex?

Hex writes each byte as two characters. Asking for 16 bytes gives 32 hex characters and 128 bits of randomness.