Skip to content
🔑

Secure Token Generator

Generate API keys, hex secrets, and UUIDs with cryptographic randomness.

Runs in your browser

Updated

—

Five shapes, one source

A type menu chooses the alphabet and a slider sets the length from 8 to 128, defaulting to 32; every change regenerates the value. Hex, Base64URL, letters plus digits and numeric PIN all draw bytes from crypto.getRandomValues. UUID ignores the length and calls crypto.randomUUID. Each value shows an entropy estimate.

A worked example

At the default length of 32, hex asks for 16 random bytes, prints 32 hex characters and reports 128 bits. Base64URL asks for 24 bytes, replaces plus and slash with dash and underscore, strips the padding and keeps 32 characters, reporting 192 bits. Letters plus digits reports 190, since 32 times the base-2 logarithm of 62 is 190.5 and the figure is rounded down. A PIN reports 106 and a UUID 122. An odd length such as 33 draws 17 bytes and discards the final digit.

Bits are not the whole story

Two modes reduce a byte modulo the alphabet size instead of rejecting it. For letters plus digits, 256 is four full passes of 62 with 8 left over, so the first eight characters A to H appear five times in 256 rather than four: 1.953% against 1.563%. For a PIN, six digits are favoured at 26 in 256 against 25.

Where it stops

  • No custom alphabet, no prefix or suffix and no bulk generation.
  • Nothing is stored or logged, so a token that is not copied is lost with the tab.
  • UUID mode cannot be seeded or reproduced, and version 7 is not offered.
  • The entropy figure describes the alphabet, not the value in front of you.

Questions people ask

Is this good enough for API keys and session tokens?

Yes. The bytes come from the browser's cryptographic generator, and 32 Base64URL characters carry 192 bits. Store only a hash of the token on the server.

How is this UUID different from the UUID generator page?

This one calls the browser's cryptographic UUID function, while the UUID generator uses Math.random and is meant for fixtures, not secrets. For passwords a person types, use the password generator.