String Generator — Random Strings, Custom Charsets, Free
Generate random strings with configurable length, charset, count. UUIDs, IDs, tokens, test data. Browser-only.
About String Generator
A string generator produces random sequences of characters — useful for IDs, tokens, test fixtures, password seeds, sample data. Configurable parameters: length, charset (alphanumeric, hex, base64, custom), count, prefix / suffix, optional separators. The ZTools String Generator runs in the browser, supports cryptographically-secure random (via crypto.getRandomValues) for tokens that need real entropy, plus a deterministic seed mode for reproducible tests.
Use cases
- Generate test fixtures. 100 random IDs as test data. Predictable charset (alphanumeric), fixed length (16) — looks like real IDs without being real.
- Seed dev passwords / tokens. Need a 32-char hex token for a local API key. Generator produces it instantly with cryptographic entropy.
- Generate unique test usernames. For load testing, 1000 unique usernames with prefix "test_" + 10 random alphanumeric.
- Custom-charset codes. Voucher codes from charset "ABCDEFGHJKLMNPQRSTUVWXYZ23456789" (excludes confusing 0/O, 1/I) — 8 chars long.
How it works
- Pick length and count. Single string or batch (1 to 100,000).
- Pick charset. Alphanumeric, hex, base64-url, alphabetic, numeric, custom (paste your own char list).
- Pick RNG. Math.random (fast) or crypto.getRandomValues (cryptographically secure — slower but for real tokens).
- Configure prefix / suffix / separator. Optional. E.g. prefix "test_", separator "-" every 4 chars: test_a3F9-2B1C-...
Examples
Input: 16 hex chars × 5
Output: a3f9e2b13d0c8d12, 7c0d8d12e4f1a022, b8c2d4e6f0a1b3c5, ... (5 unique strings).
Input: 32 alphanumeric, crypto RNG
Output: Suitable as a session token. Decodes to 192 bits of entropy (close to a UUID v4).
Input: Voucher charset, 8 chars × 100
Output: 100 voucher codes like "K7P9X2VJ" — no ambiguous chars (0/O / 1/I).
Frequently asked questions
Math.random vs crypto?
Math.random is pseudo-random (predictable seed). crypto.getRandomValues sources from the OS's CSPRNG. For test data, Math.random is fine. For tokens / passwords / session IDs, use crypto.
How much entropy do I need?
Session tokens: 128+ bits (16 hex chars or 22 base64 chars). API keys: 256 bits. Voucher codes: 40+ bits is usually enough (8 chars from a 32-char alphabet ≈ 40 bits).
Can I exclude ambiguous chars?
Yes — preset for "no ambiguous" (excludes 0/O, 1/I/l) is built in. Or paste a custom charset.
Privacy?
All in browser.
Pro tips
- For real tokens, always use crypto RNG. The performance difference is negligible at typical scale.
- For voucher / coupon codes, exclude 0/O/1/I/l — humans confuse them and complaints multiply.
- For UUIDs specifically, use a UUID generator — RFC 4122 specifies the format, including version bits.
- For seeded reproducibility, use Math.random with a seed — crypto RNG is non-reproducible by design.
Reviewed by Ahsan Mahmood · Last updated 2026-05-06 · Part of ZTools.
For the full,
formatted version of this page, please enable JavaScript and reload
https://ztools.zaions.com/random-string.