🎲 Random String Generator

Generate cryptographically random strings with a fully customizable charset, length, count and output format — all client-side via crypto.getRandomValues.

Presets:
Character Set
Custom chars (append)
0 custom chars
Active charset preview
0 characters in charset
Parameters
String Length
Min: Max:
Length
Fixed length: 32 chars
Count
Count
Options
Separator between strings
Entropy & Strength
Bits of entropy per string
Formula: entropy = length × log₂(charset size)
Output
Click "Generate" to create random strings…
Character Frequency (first string)
Generate strings to see character distribution.
Generation History
No generations yet

Random String Generation — Reference

Cryptographic Randomness

This tool uses crypto.getRandomValues() — the browser's CSPRNG (Cryptographically Secure Pseudo-Random Number Generator). Unlike Math.random(), it is suitable for generating secrets, tokens, API keys and passwords where predictability would be a security risk.

Entropy Calculation

Entropy in bits = length × log₂(charset size). A 32-char string from a 62-char charset (a-zA-Z0-9) has ~190 bits of entropy — far beyond brute-force range. For passwords, 128+ bits is generally considered secure. Adding special characters dramatically increases entropy per character.

Rejection Sampling

To avoid modulo bias (which skews distribution toward lower characters), this generator uses rejection sampling: it discards any random byte that falls outside the largest multiple of the charset size that fits in a byte, ensuring perfectly uniform character distribution across all charset positions.

UUID v4 Format

The UUID v4 preset generates RFC 4122-compliant UUIDs: 128 random bits with specific version (4) and variant (10xx) bits set, formatted as xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. UUIDs are commonly used as database primary keys, session identifiers and distributed system IDs.