Random String Generator
Random strings, in the alphabet you pick.
Random strings, in the alphabet you pick.
How to use it
- Pick an alphabet. Hex for anything a machine reads, base58 for anything a person types back, alphanumeric for general use.
- Set the length. The line underneath shows how many bits each string carries, which is what actually describes its strength.
- Copy them. One per line, ready for a fixture file, a seed script or a batch of test records.
When you would use this
Random strings get used for things that matter more than their length suggests: test fixtures, seed data, coupon codes, sometimes tokens that guard something real. The quality of the randomness is invisible in the output, so it is worth saying where this comes from. Every character is drawn from the browser's cryptographic source using rejection sampling rather than a modulo, which is the difference between a uniform distribution and one quietly skewed toward the earlier characters of the alphabet. The base58 alphabet is worth choosing whenever a person will read the value back: it omits zero, capital O, capital I and lower case L, which are the four characters that cause transcription errors in practice.
Questions
- Can you see what this generates?
- No. There is no server involved. The page is static files and the randomness comes from your own browser, so there is nothing for anyone to log.
- What is base58 for?
- It leaves out 0, O, I and l, the four characters people confuse when reading a code aloud or typing it off a screen. Worth it for anything humans handle.
- Are these safe as API keys or tokens?
- The randomness is, being the same source browsers use for security tokens. Whether the length is enough depends on what it guards, and the entropy figure underneath tells you what you have.