ZapKit

Random String Generator

Generate cryptographically secure random strings for tokens, coupon codes, IDs, test data and invite links, from any set of characters.

What is a random string generator?

A random string generator produces sequences of characters picked at random, used wherever something needs to be unique and hard to guess: API tokens, session IDs, password reset links, invite and referral codes, voucher codes, salts and test fixtures.

This generator uses the browser's cryptographically secure randomness, lets you choose exactly which characters may appear, and shows the entropy so you know how strong each string is. Developers use it for keys and test data; marketers for discount codes; teachers and event organisers for unique access codes.

How to use the Random String Generator

  1. 1.Set the length

    From 1 to 4,096 characters.

  2. 2.Choose the characters

    Letters and digits, hex, URL-safe, easy-to-read, symbols or your own list.

  3. 3.Generate and copy

    Up to 100 strings at once, each on its own line.

Example: string sizes and strength

Entropy for 32-character strings from different sets:

Letters and digits (62)
191 bits
Hexadecimal (16)
128 bits
URL-safe (64)
192 bits
Easy to read (55)
185 bits

entropy = length × log₂(set size)

Thirty-two random characters from any of these sets is far beyond brute-force reach.

Unbiased and unpredictable

Characters are chosen with the Web Crypto random generator and rejection sampling, so every character in the set is exactly as likely as any other. Simple approaches using Math.random or a modulo can be predictable or slightly biased, which matters for anything security-related.

The easy-to-read set leaves out characters that look alike, 0 and O, 1, l and I, which suits codes people type from paper or say over the phone. URL-safe strings can go straight into links and file names without encoding.

Frequently asked questions

How long should a random token be?

For security tokens, at least 128 bits: 22 URL-safe characters or 32 hex characters.

Can I make coupon codes?

Yes. Choose Easy to read, a length of 8–12 and generate as many as you need.

Are duplicates possible?

Theoretically, but with 16+ characters from a large set, the odds are astronomically small.

Is this suitable for passwords?

Yes, though the password generator adds options like guaranteed symbols and strength checks.

More Developer tools