Encoding & Security Tools

Random String Generator

Generate random tokens, coupon codes and keys with any character set.

What can you use random strings for?

Developers and businesses need unpredictable codes all the time: API keys, session tokens, email verification links, invite codes, discount coupons, test data and unique file names. This generator creates them in bulk with exactly the characters and length you need, using cryptographically secure randomness from your browser.

How to use the generator

  1. Choose a character set, or pick Custom and type your own characters.
  2. Set the length and how many strings you need (up to 1,000).
  3. Optionally add a prefix, such as DIWALI- for coupons or sk_test_ for keys, and group characters with dashes to make them easier to read.
  4. Click Generate, then copy or download the list.

Choosing the right character set

UseSuggested setSuggested length
API key or secret tokenBase64URL or letters and numbers32 or more
Coupon or voucher codeCustom set without 0/O and 1/I8–12, grouped
Hex ID or saltHexadecimal32 (128 bits)
One-time PIN for testingDigits only6

The default custom set, ABCDEFGHJKMNPQRSTUVWXYZ23456789, removes characters that are easily confused when read aloud or typed from a printed card.

How secure are these strings?

Randomness is measured in bits: length × log₂(number of characters). For secrets such as API keys, aim for at least 128 bits, for example 22 Base64URL characters or 32 hex characters. The tool uses crypto.getRandomValues and avoids "modulo bias", so every character is exactly equally likely. Simple generators that use Math.random() are not safe for security purposes.

Frequently asked questions

Can two strings be the same?

With long strings, duplicates are practically impossible. For short codes, like 6 digits, duplicates can happen, so check your list before using it.

How is this different from the password generator?

The Password Generator guarantees a mix of character types for login passwords. This tool gives full control over the alphabet, prefix and format for codes and keys.

Are generated strings stored?

No. They exist only in your browser until you copy them.