zodml

Random String Generator

Coupon codes, test data, booking references, temporary IDs, sample passwords — they all need random strings in a particular shape. Choose the characters or type a pattern, set the length and how many you need, and get a batch of unique strings you can copy or download.

Random string generator

Random Code and Test Data Pack

Coupon code planning workbook with entropy and guess-risk formulas, a printable code card template, a test data planning sheet and a security checklist for codes and tokens.

Formats: XLSX, PDF, DOCX. Instant download after payment (link valid 72 hours, up to 5 downloads). AI-assisted: the templates were drafted with AI help and reviewed and laid out by Kedop.

$3.00 USD, one-time

Secure card checkout by Stripe. Full refund within 7 days — see the refund policy and license.

Character sets and entropy

CharactersSizeBits per characterLength for ~64 bits
Digits 0–9103.3220
Hex 0–9 A–F164.0016
Upper-case A–Z264.7014
A–Z + 0–9365.1713
A–Z + a–z525.7012
A–Z + a–z + 0–9625.9511
Alphanumeric + 13 symbols756.2311

Entropy measures how many equally likely strings the generator could produce: bits = length × log₂(number of characters). Every extra bit doubles the number of possibilities.

Patterns

Pattern mode builds strings with a fixed shape. Each A becomes a random capital letter, a a lowercase letter, 9 a digit, # a symbol, ? a hexadecimal digit and * any letter or digit; every other character — hyphens, spaces, fixed letters — is kept as typed. “AAA-9999” produces codes like KTR-4827, “SALE-****” gives SALE-7QX2, and “????-????-????” makes grouped hex IDs. Grouping characters with hyphens makes long codes much easier to read aloud and type.

Worked example

A shop needs 500 one-time coupon codes that customers will type from a printed card. Choosing the pattern “SPRING-AAAA99” with look-alikes excluded, each code has four letters from a 21-letter alphabet (no O, I, S, Z or B) and two digits from 0–9 minus the look-alikes 0, 1, 5, 2 and 8 — about 22 bits and roughly 4.9 million possible codes. The generator removes any duplicates, so all 500 are unique, and the chance of a customer guessing a valid code at random is about 1 in 9,700. The shop downloads the codes as CSV and imports them into its checkout.

How many strings can you generate before duplicates appear?

Even with millions of possibilities, random duplicates appear sooner than intuition suggests — the “birthday problem”. The chance of at least one repeat in a batch of n strings from N possible values is roughly 1 − e^(−n²/2N). For 500 codes from 4.9 million, that is about 2.5%, and for 5,000 codes it would be over 90%. The generator removes duplicates automatically, and the result panel shows the probability so you can decide whether you need a longer pattern. For values that must never collide across separate batches, check them against your existing database or use a longer string.

Choosing length and characters

PurposeSuggested formatApprox. bits
Order or booking referenceAAA-9999 or 8 letters/digits, no look-alikes25–40
Coupon code typed by customersPREFIX-AAAA99 or 8 capitals22–38
Invitation or access code10–12 letters and digits55–70
API key or reset token22+ letters and digits, or 32 hex128+
Test data IDsAny format that matches your field rulesas needed

For anything that protects access, prefer more bits; for anything people read aloud or type, prefer fewer, clearer characters and add server-side limits.

Custom character sets

Type your own alphabet in the custom field to control exactly which characters appear — for example only capitals and digits that are unambiguous in your font, or only the letters allowed by a legacy system. Repeated characters are ignored, so each allowed character is equally likely, and the look-alike filter still applies if it is switched on.

Common uses

Security notes

Strings are generated with crypto.getRandomValues, the browser’s cryptographically secure generator, with rejection sampling so every character is equally likely. For secret values such as API keys and password-reset tokens, aim for at least 128 bits and store only a hash on the server. For codes customers type, balance length with readability: exclude look-alikes, use capitals only, and group characters. Codes that grant something valuable should also be rate-limited and single-use on the server side.

Privacy

Everything is generated on your device. Nothing is sent to our server, and the strings are not stored.

Frequently asked questions

How do I generate a random string?

Pick the character types and length, or type a pattern, then press Generate.

Are the strings unique?

Yes — duplicates in each batch are removed, up to the number of possible values.

What does excluding look-alikes do?

Removes characters people confuse, such as 0 and O or 1, l and I.

How long should a random string be?

For secrets, about 22 characters of letters and digits (128 bits); for typed codes, as short as your guessing risk allows.

Can I export to CSV or JSON?

Yes, choose the output format and download.

Why was the batch smaller than I asked for?

Your pattern allows fewer unique values than the number requested; make it longer or add character types.

What is the birthday problem?

The surprisingly high chance of duplicates in random batches; the tool shows it and removes repeats.

Can I add a prefix or suffix?

Yes — they are added to every string and don’t affect the entropy.

How many strings can I make at once?

Up to 10,000 per batch.

Which characters count as look-alikes?

0 and O, 1, l, I and |, 5 and S, 2 and Z, and 8 and B.

Is this cryptographically secure?

It uses your browser’s cryptographic random generator.