1. Home
  2. Developer
  3. Random String Generator

Random String Generator

Make tokens, codes and test strings with the length and characters you pick.

Runs in your browser · No upload
1 to 4,096 characters
1 to 1,000 strings
Quick picks
Character types
These characters are added to the pool. Emoji and non-Latin letters count as one character each.

How to use

  1. Enter the Length and Count. Length can be 1 to 4,096 characters, and count 1 to 1,000 strings.
  2. Under Quick picks, choose a set that fits your use (letters + digits, hex, digits only, coupon code style), or tick the character types yourself.
  3. If you need them, add Extra characters, a prefix or suffix, or turn on the no-repeat option.
  4. Copy the result or save it as a .txt file. Changing any option generates new strings right away, and Generate again gives you fresh values with the same settings.

Quick picks

Name Characters Typical use
Letters + digits a-z A-Z 0-9 (62) General tokens, temporary IDs
Hex lowercase / uppercase 0-9 a-f or A-F (16) Hash-style IDs, color code tests
Digits only 0-9 (10) PINs, testing verification code formats
Letters only a-z A-Z (52) Testing name fields
Coupon code style Uppercase letters and digits, without 0 O 1 I Codes people read and type by hand
URL safe Letters, digits, - and _ Tokens that go in URLs or file names

Options

  • Exclude look-alike characters: removes 0 O 1 l I |. Useful for codes people read off paper or hear over the phone.
  • Include at least one of each chosen type: if lowercase, uppercase and digits are all ticked, every string contains at least one of each. Use it to meet a site’s password rules.
  • No repeated characters within a string: no character appears twice in the same string. The length can’t be more than the number of distinct characters in use, so with digits only, the maximum length is 10.
  • Prefix and suffix: fixed text such as sk_ or ORD-. It doesn’t count toward the length.

How hard is it to guess?

The randomness (bits) figure is length × log2(number of characters). With the 62 letters and digits, 16 characters give 16 × log2(62), about 95.3 bits. A 6-digit number is only about 19.9 bits, small enough that every value can be tried in a short time, so it isn’t enough to protect an account. For a login password, use the Password Generator.

Where the randomness comes from

The tool uses random values from the browser’s crypto.getRandomValues, not the predictable Math.random(). When it picks characters, it throws away values from the uneven top of the range and draws again, so characters early in the set aren’t favored by the remainder operation (modulo bias).

Good to know

  • Requests where length times count is more than 1,000,000 are refused, because they would slow your browser down.
  • The tool doesn’t check that every string is different. With short lengths and small character sets, duplicates can happen. If your IDs must never collide, use the UUID Generator or make them long enough.
  • Values are generated only in your browser. They are never sent to a server and are not stored.

FAQ

How long should a random string be?

It depends on what it’s for. Codes that people type can be 6 to 10 characters. Tokens that must not be guessed should be 22 or more letters and digits (about 130 bits). Use the randomness figure on screen to decide.

How do I generate a random hex string?

Click the hex lowercase or uppercase quick pick and set the length. A 32-character result looks like a 128-bit value written in hex.

Can I use non-English letters or emoji?

Type them into Extra characters. To use only your own characters, untick the letter and digit boxes. Non-Latin letters and emoji count as one character each, so the length comes out exact.

Can I make passwords with this?

The randomness is fine, but the Password Generator adds a strength meter and rule matching, so it’s the better choice for passwords.

Are my settings sent anywhere?

No. Everything is generated in your browser and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.