Random String Generator

One input per line. Output is numbered to match the input order.
Pinned tools are listed in your favourites on the home page.Copies a link to this tool that carries your current input, so it opens ready to run.Gives you an iframe snippet for putting this tool on your own site.

Characters come from crypto.getRandomValues, never Math.random, and are picked by rejection sampling so no character is more likely than another. Generation happens in this tab — nothing is sent anywhere, and nothing is stored.

Ctrl+Enter Run  · Ctrl+Shift+C Copy  · Esc Clear

Understand Random String Generator

Generates cryptographically random strings of a chosen length from a character set you select.

How it works

Values come from crypto.getRandomValues, the platform cryptographically secure generator, rather than Math.random, whose internal state can be recovered from a handful of observed outputs and its future values predicted. Strength is entropy, and each character contributes log2(alphabet size) bits: 32 hex characters carry 128 bits, while 32 characters of a 62-symbol alphanumeric set carry about 190.

When to use it

  • Generating an API key, a session secret, or a webhook signing key.
  • Producing a SECRET_KEY or JWT_SECRET value for a local .env file.
  • Creating a one-off nonce, salt, or invite code.
  • Making a random suffix for a bucket, container, or test resource name that must not collide.
  • Filling a fixture that needs an opaque token of a specific length and shape.

Watch out for

  • Length has to be read against the alphabet. 16 hex characters is only 64 bits and within reach of a determined attacker, while 16 characters of a 62-symbol set is about 95. Target 128 bits or more for anything long-lived.
  • Random is not unique. Two independent draws can coincide, so when the value is a primary key or a file name either use a UUID or ULID or check for a collision rather than assuming.
  • Restricted character sets exist for a reason. A value that will live in a URL, a shell command, or a .env file should avoid characters that need quoting or escaping — hex and alphanumeric travel everywhere without surprises.
  • Anything generated in a browser tab has been in a browser tab. For a production signing key, prefer openssl rand -base64 32 or the secret manager your platform already provides, where the value never touches a page, a clipboard manager, or browser history.

Not the right tool for: Keys that must be an exact number of random bytes. An AES key or an HMAC secret is binary, and a 32-character hex string is 16 bytes of entropy rather than 32 — generate raw bytes or derive the key with a KDF instead.

Frequently Asked Questions

How do I generate a random string?

Set the length, choose how many strings you want, and tick the character sets to draw from — or paste a custom alphabet such as 0123456789abcdef for hex. Click Generate and copy the whole batch at once. Everything is produced locally in your browser.

Is this random string generator secure?

Characters come from crypto.getRandomValues, the browser's cryptographically secure source, and are selected by rejection sampling so no character is more likely than another. Math.random is never used — it is predictable and unsuitable for tokens, keys or passwords.

How long should a random string be?

The tool shows the entropy in bits. Roughly: 64 bits is fine for an identifier, 128 bits or more for anything secret such as an API key or session token. A 22-character alphanumeric string carries about 128 bits.

How to Use Random String Generator

  1. Paste or type your input in the input area above.
  2. The tool processes your input automatically or click Run.
  3. Copy or download the result using the action buttons.
  4. Use Ctrl+Enter to run quickly from the keyboard.