Common questions from developers about how to generate secure random strings for API keys, session tokens, activation codes, and URL IDs
Is this random string generator cryptographically secure?
Yes -- this tool uses the browser's crypto.getRandomValues() API, which is a cryptographically secure pseudorandom number generator (CSPRNG) backed by your operating system's entropy pool. This is the same randomness source used for generating TLS session keys, cryptographic nonces, and UUID tokens. Unlike JavaScript's Math.random(), which uses a deterministic algorithm that can be predicted given its internal state, crypto.getRandomValues() produces true cryptographic randomness. Every character in every generated string is selected with equal probability using this secure source. Nothing is transmitted to any server -- all generation runs entirely in your browser.
What is the no-ambiguous character set and when should I use it?
The no-ambiguous preset removes characters that look visually identical or nearly identical in most fonts: the digit 0 (zero) and the letter O, the digit 1 (one), the lowercase letter l, and the uppercase letter I. These characters cause transcription errors when a person reads a code on one device and types it into another. Use the no-ambiguous preset whenever humans need to read and manually type the generated string -- activation codes, software licence keys, promotional vouchers, Wi-Fi passphrases displayed on screens, and any short-lived verification codes sent by SMS or printed on paper.
What is base62 encoding and what is it used for?
Base62 uses 62 characters: the 26 uppercase letters A-Z, the 26 lowercase letters a-z, and the 10 digits 0-9. It excludes all symbols and punctuation, making it completely URL-safe without any percent-encoding required. Base62 is the most widely used encoding for URL shortener IDs (converting long numeric IDs to short codes like bit.ly/abc123), session tokens in web applications, referral and invite codes, API keys that need to be embedded in URLs, and database primary keys that need to be compact and human-readable. A 22-character base62 string provides approximately 131 bits of entropy, equivalent to a standard 128-bit UUID.
How long should a random string be for use as an API key or session token?
For security tokens used in web applications, the NIST guidelines (SP 800-107 and SP 800-63B) recommend a minimum of 128 bits of entropy. Using base62, this requires 22 characters; using hex, this requires 32 characters. For most practical applications, 32 characters of base62 (approximately 190 bits of entropy) is the recommended standard -- it provides a comfortable security margin above the 128-bit minimum and is a manageable length to store, display, and transmit. For short-lived one-time codes (email verification, password reset), 16-24 characters of base62 is typically sufficient when combined with a short expiry window and rate limiting.
What is entropy in a random string and how is it calculated?
Entropy measures how unpredictable a string is, expressed in bits. The formula is: entropy bits = length x log2(charset_size). Each additional bit of entropy doubles the number of possible strings an attacker must try to guess yours by brute force. A 32-character hex string (16 possible chars) has 32 x 4 = 128 bits of entropy. A 32-character base62 string (62 possible chars) has 32 x 5.95 = ~190 bits. A 32-character password string (94 possible chars) has 32 x 6.55 = ~210 bits. The entropy display in this tool updates live as you change settings, so you can see exactly how your configuration translates to security level before generating.
What is the difference between a random string generator and a UUID generator?
A UUID (Universally Unique Identifier) is a standardised 128-bit identifier with a fixed format: 8-4-4-4-12 hexadecimal characters separated by hyphens, for example 550e8400-e29b-41d4-a716-446655440000. UUID version 4 is randomly generated and provides 122 bits of entropy (6 bits are fixed format bits). A random string generator is more flexible -- you can choose any character set, any length, and any count, and the output has no fixed format. Random string generators are better for API keys, session tokens, and custom IDs where you want to control length and character set. UUIDs are better when you need a standardised format compatible with databases, systems, and protocols that specifically expect UUID format.
Can I use this tool to generate API keys for my application?
Yes -- this tool is well-suited for generating API keys. For a production API key, use the base62 preset at 32 characters (approximately 190 bits of entropy) or the password preset at 32 characters (approximately 210 bits of entropy). API keys generated here are cryptographically random and suitable for use as long-lived access credentials. When using generated keys in production, store only the hash (SHA-256 or bcrypt) of the key in your database -- never the raw key itself -- and transmit them only over HTTPS. Consider prefixing your API keys with a service identifier (like sk_live_ or pk_test_) to make them identifiable in logs and easy to revoke by prefix.
How does bulk generation work and how many strings can I generate at once?
The Count input allows you to generate up to 100 unique random strings simultaneously in a single click. Each string in the batch is generated independently by filling a single large Uint32Array with crypto.getRandomValues() -- all strings are generated in one cryptographic call for efficiency, then split by length. Every string in the batch is equally random and statistically independent. Use the Copy All button to export the entire batch to your clipboard as a newline-separated, comma-separated, or space-separated list for pasting into code, configuration files, spreadsheets, or password manager import templates. Bulk generation is useful for pre-generating session tokens, generating test data, or provisioning multiple API keys simultaneously.
What is the hex preset good for and why would I use it over base62?
The hex preset generates strings using only the 16 hexadecimal characters 0-9 and a-f, producing strings that are compatible with common cryptographic output formats. Use hex when your generated string needs to look like or replace a hash value (MD5 produces 32 hex chars, SHA-1 produces 40, SHA-256 produces 64), when you are generating colour codes or colour palettes, when integrating with systems that specifically expect hexadecimal input, or when you need to store the value as raw bytes (two hex chars per byte). Hex is less entropy-dense than base62 (4 bits vs 5.95 bits per character), so you need a longer hex string to achieve the same security level as a shorter base62 string.
Are the generated strings stored anywhere or sent to a server?
No -- all random string generation in this tool runs entirely in your browser using the Web Crypto API. Your configuration settings, the generated strings, and any text you copy are never transmitted to any server, never logged, never stored in any database, and never used for any analytics or tracking purpose. The tool has no server-side component whatsoever -- it is a fully static client-side application. You can verify this by opening your browser's network inspector (F12 -> Network tab) while generating strings -- you will see zero outgoing API requests. This makes the tool completely safe to use for generating production credentials, API keys, and security tokens.