Skip to content

Random String Generator

Pick a length and an alphabet, press Generate, and get a list of random strings to copy or download. Each run also shows how many bits of entropy the settings give.

Runs in your browserFree, no sign-upLast reviewed

Settings

Fill in the settings to see your result here.

Your result appears here instantly — nothing is uploaded.

Quick answers

How do I generate a random alphanumeric string?
Leave Alphabet on Letters and numbers, set Length to the number of characters you need and press Generate. Each character is drawn from A-Z, a-z and 0-9, 62 possibilities in all. For lowercase only, choose Lowercase letters and numbers, which uses 36.
How many 8-character alphanumeric strings are possible?
62 to the power of 8, which is 218,340,105,584,896, when upper and lower case letters and digits are all allowed. That is about 47.6 bits of entropy. With lowercase letters and digits only, the count drops to 36 to the power of 8, about 2.8 trillion.
How long is a 128-bit random hex string?
32 characters. Each hexadecimal character carries exactly 4 bits, so 32 of them make 128 bits and 64 make 256 bits. In this tool, choose Hexadecimal and set Length to 32; the output is lowercase 0-9 and a-f.
Can I use these random strings as passwords or API keys?
No. The strings come from a non-cryptographic pseudo-random generator that starts from one of a million seeds, so they are guessable in principle. Use them for test data and placeholders. Create real secrets with a cryptographic source such as crypto.getRandomValues or your server's secure random function.
Can I make a 6 digit or 12 digit alphanumeric code?
Yes. Set Length to 6 or 12 and keep Letters and numbers selected. A 6-character code has about 56.8 billion possible values (35.7 bits) and a 12-character code about 71.5 bits. The shortest length available is 4.
What is the difference between alphanumeric and hex strings?
Alphanumeric strings use 62 characters (A-Z, a-z, 0-9) and carry about 5.95 bits per character. Hex strings use 16 characters (0-9, a-f) and carry 4 bits each. A hex string needs roughly half as many characters again to hold the same randomness.

About Random String Generator

This tool makes 1 to 50 random strings at a time, each 4 to 128 characters long, from one of six alphabets: letters and numbers (62 characters), letters only, lowercase letters and numbers, digits only, hexadecimal, or Base58. The default is five 24-character alphanumeric strings. You can put a fixed prefix such as sk_test_ in front of every string, and a Details panel reports the alphabet size, the entropy in bits and the total length. The strings are made by a fast pseudo-random generator, not a cryptographic one, so they suit test data, sample codes, placeholder keys and filenames. Do not use them as real passwords, API keys or session tokens.

Entropy of a random string by length and alphabet

These are the Entropy figures the Details panel shows for each setting. Higher means more possible strings: every extra bit doubles the count.

LengthLetters and numbers (62)Lowercase and numbers (36)Base58 (58)Hexadecimal (16)Digits only (10)
423.8 bits20.7 bits23.4 bits16 bits13.3 bits
635.7 bits31 bits35.1 bits24 bits19.9 bits
847.6 bits41.4 bits46.9 bits32 bits26.6 bits
1059.5 bits51.7 bits58.6 bits40 bits33.2 bits
1271.5 bits62 bits70.3 bits48 bits39.9 bits
1695.3 bits82.7 bits93.7 bits64 bits53.2 bits
22131 bits113.7 bits128.9 bits88 bits73.1 bits
24142.9 bits124.1 bits140.6 bits96 bits79.7 bits
32190.5 bits165.4 bits187.5 bits128 bits106.3 bits
64381.1 bits330.9 bits374.9 bits256 bits212.6 bits
128762.1 bits661.8 bits749.8 bits512 bits425.2 bits

Letters only (52 characters) gives 45.6 bits at length 8, 68.4 bits at 12 and 91.2 bits at 16. The figure describes the settings, not the quality of the randomness behind them.

Sample output for common settings

Each row is real output from the tool for those settings. Your strings will be different every time you press Generate.

6-character alphanumeric codes

Length 6, How many 3, Alphabet: Letters and numbers

8TeyfV, Ev9zc6, 38mPdS

Entropy 35.7 bits. These three happen to mix letters and digits, but nothing forces a mix; a string can come out as letters only.

10-character lowercase codes

Length 10, How many 3, Alphabet: Lowercase letters and numbers

9lr3smc193, q868wirk15, x22xqclh1d

Entropy 51.7 bits. Useful where capital letters are a nuisance, such as coupon codes people type by hand.

32-character hex strings

Length 32, How many 2, Alphabet: Hexadecimal

f47d851cfd7fefa374cdacca7153c141, ae530ac09be09e9d7448b41d6e202c6b

Entropy 128 bits. Same shape as an MD5 digest or a UUID without hyphens.

16-digit number strings

Length 16, How many 2, Alphabet: Digits only

9348530798498962, 4378677640327120

Entropy 53.2 bits. Digit strings may begin with 0, so keep them as text in a spreadsheet.

Base58 share codes

Length 10, How many 3, Alphabet: Base58 (no 0 O I l)

yJVpWM5mzp, TwtydFUJms, enneT5KCk6

Entropy 58.6 bits. None of the look-alike characters 0, O, I or l can appear.

Placeholder API key with a prefix

Length 24, How many 1, Alphabet: Letters and numbers, Prefix: sk_test_

sk_test_8TeyfVEv9zc638mPdSv1owwo

Random length 24, Total length 32, Entropy 142.9 bits. The prefix adds length but no entropy.

The six alphabets and what each contains

Alphabet optionCharacters usedAlphabet sizeBits per character
Letters and numbersA-Z, a-z, 0-9625.95
Letters onlyA-Z, a-z525.70
Lowercase letters and numbersa-z, 0-9365.17
Digits only0-9103.32
Hexadecimal0-9, a-f (lowercase)164.00
Base58 (no 0 O I l)1-9, A-Z without I and O, a-z without l585.86

There is no option for symbols, uppercase-only strings or a custom character list.

How the entropy figure is calculated

entropy in bits = length x log2(alphabet size)

Each character is chosen independently, so every position multiplies the number of possible strings by the alphabet size. Twelve characters from 62 gives 62^12 possible strings, and log2 of that is 12 x 5.954 = 71.5 bits. Length matters more than alphabet: going from hex to letters and numbers adds under 2 bits per character, while one extra character adds between 3.3 and 6 bits, depending on the alphabet. The prefix is a fixed, known value, so it is left out of the calculation and only counted in Total length.

How random these strings are, and where to use them

Every press of Generate starts a small pseudo-random generator called Mulberry32 from a seed between 0 and 999,999, then draws one character at a time from the chosen alphabet. The output looks uniformly random and passes for it in any test fixture, but two things follow from that design. The generator is not cryptographically secure, and for any given settings there are at most a million different batches the tool can produce, however long the strings are.

That is fine for the jobs people usually want a quick string for: filling a database column in a staging environment, sample order or ticket references, dummy tokens in documentation, unique-looking filenames, raffle or classroom codes, and test input for form validation. It is not acceptable for anything an attacker would gain from guessing. For those, generate the value in your own code with a cryptographic source: crypto.getRandomValues in a browser, crypto.randomBytes in Node.js, secrets.token_hex or secrets.token_urlsafe in Python.

Limits worth knowing before you generate

  • Length runs from 4 to 128 characters. The slider stops at both ends.
  • One run produces at most 50 strings. Press Generate again for another set.
  • Strings in a batch are not checked against each other. Long strings will not repeat in practice, but 4-digit strings can, because only 10,000 exist.
  • A string is not guaranteed to contain both letters and digits. Each character is an independent draw from the whole alphabet.
  • Hex output is lowercase. Convert the case separately if you need capitals.
  • Base64 is not one of the alphabets. Letters and numbers is the closest match: it is the Base64 character set without +, / and = padding.

How to use it

  1. 1

    Drag Length to the number of random characters you want in each string, from 4 to 128.

  2. 2

    Set How many to the number of strings you need, from 1 to 50.

  3. 3

    Choose an Alphabet: Letters and numbers, Letters only, Lowercase letters and numbers, Digits only, Hexadecimal, or Base58 (no 0 O I l).

  4. 4

    Optionally type a Prefix that will be placed at the start of every string.

  5. 5

    Press Generate. Copy the strings or download them as strings.txt, and press Generate again for a new set.

Answers to common questions

What is Base58 and when should I pick it?
Base58 is the letters-and-numbers set with four characters removed: the digit 0, capital O, capital I and lowercase l. They look alike in many fonts, so leaving them out helps when a code will be read aloud, written down or retyped. Bitcoin addresses use the same alphabet. It costs almost nothing in entropy: 5.86 bits per character against 5.95.
Does the prefix make a string more secure?
No. A prefix is the same on every string and known to anyone who has seen one, so it adds length without adding randomness. Prefixes such as sk_test_ exist so that a value can be recognised in logs and so that test and live keys are easy to tell apart.
How long should a random ID be?
It depends on what it protects. To avoid accidental clashes between a few million records, around 64 bits is plenty: 11 alphanumeric or 16 hex characters. For an unguessable token the usual target is 128 bits: 22 alphanumeric or Base58 characters, or 32 hex characters. Remember that this tool's output should not be used for the second case.
Can I generate a random string of numbers only?
Yes. Choose Digits only and set the Length. Each digit carries 3.32 bits, so a 6-digit string has one million possible values and a 16-digit string about 53.2 bits. The result is a text string and can start with one or more zeros.
Can I get uppercase letters and numbers only?
Not directly. The alphabets are fixed, and none is uppercase plus digits. Generate with Lowercase letters and numbers and convert the result to upper case; the entropy is the same, 5.17 bits per character.
Can I generate a random Base64 string?
Not a true one. Base64 has 64 characters including + and /, and those two are not in any alphabet here. If you only need something that looks like Base64 text, Letters and numbers is close. To get real Base64, generate random bytes in code and encode them.
Will I ever get the same strings twice?
Rarely, but it can happen. Each run starts from one of a million seeds, and the same seed with the same settings gives the same batch. If you need values that are guaranteed unique across runs, check them against the ones you already have.
Are the strings sent to a server?
No. They are generated by JavaScript in your browser and shown on the page. The Download button saves strings.txt from the page itself, with one string per line.

Looking for something else? Browse all generators or see every tool.