Random string generator — any length, any character set

Choose a length and the characters to draw from, or type your own set, and the tool makes up to 1,000 random strings and tells you how many bits of randomness each one holds.

Live demo · real result from this tool

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use the random string generator

  1. Set the Length, from 1 to 4,096 characters (24 by default).
  2. Tick the sets to draw from: Uppercase, Lowercase, Digits and Symbols. The first three are on by default.
  3. Tick Exclude look-alikes to drop 0, O, o, 1, l and I.
  4. Or type your own characters into Custom character set (overrides the boxes).
  5. Set How many strings (up to 1,000) and press Generate.

What it does and when to use it

Developers and testers need random text all the time: a salt or a secret for a config file, a long token for a test, filler data to check how a form handles 255 characters, or a batch of codes made only from letters a customer can read easily. This tool covers all of those with one length setting and one alphabet.

The custom box is the flexible part. Type ACGT for random DNA sequences, 01 for binary strings, or ABCDEFGHJKMNPQRSTUVWXYZ23456789 for codes that avoid confusing characters. If you only need hexadecimal, the random hex generator works in bytes and can add a 0x prefix. For short IDs with a collision estimate, use the Nano ID generator. For codes with a prefix and dashes, see the coupon code generator.

How it works

The tool joins the chosen sets into one alphabet, removes look-alikes if asked, and then picks each character with crypto.getRandomValues. Rejection sampling makes every character in the alphabet equally likely, even when the alphabet size does not divide evenly into 2^32.

Entropy per string = length × log2(alphabet size). It is a fair measure here because every character is chosen independently and uniformly. Character set size is the alphabet size after removals.

Worked examples

  • Defaults. 24 characters from upper case, lower case and digits (62 symbols) give Entropy per string: 142.9 bits.
  • A small custom set. Length 8 with the custom set ABC123 gives Character set size: 6 and 20.7 bits per string, with outputs like 12BA3C11. That is fine for a demo but easy to guess.
  • Everything except look-alikes. Length 32 with symbols on and look-alikes excluded leaves Character set size: 70 and 196.1 bits per string.
  • A set that is too small. A custom set of zzz holds one distinct character, so the tool answers “Choose at least two different characters to draw from.”

Limits and tips

  • The tool does not remove duplicates across a batch. With short strings from a small set, repeats are likely.
  • Very long strings in large batches can make the page slow to display; copy them out and clear the page.
  • A random string is only secret until it is shared. Do not paste live secrets into chat or tickets.

Frequently asked questions

Which symbols are included?
Ticking Symbols adds these 14 characters: ! # $ % & * + - = ? @ ^ _ ~. There are no quotes, brackets, slashes or spaces, which helps in config files. Some of them, such as & and #, still need escaping in URLs. If you need a different set, type it into the custom box.
How does the custom character set work?
When the box is not empty, it replaces the four tick boxes completely. Each distinct character counts once, so "AABBC" is the same as "ABC". The set needs at least two different characters.
How long should a random string be?
For something that must not be guessed, aim for at least 128 bits. With the default 62 letters and digits that means 22 characters or more; the default length of 24 gives 142.9 bits. For a test value or a filler string, any length works.
Is this the same as a password generator?
The randomness is the same, but this tool has no rule that every type must appear and no strength label. Use the bulk password generator when a login system demands at least one digit, one symbol and so on.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close