Skip to main content
DigiToolBay
Data and Security ToolsClient-Side Browser Processing

Random String Generator

Generate cryptographically random hex, alphanumeric, Base64URL, or custom-alphabet strings.

Loading Random String Generator...

Generated locally via crypto.getRandomValues().

By DigiToolBay Editorial TeamPublished & verified:

About Random String Generator: Guide & Practical Notes

Generating webhook verification secrets, test API tokens, invite codes, or cryptographic salts quickly requires exact character alphabets without predictable `Math.random()` bias.

Generates 1 to 200 unbiased cryptographic random strings (1–256 chars long) via `crypto.getRandomValues()` rejection sampling across Alphanumeric, Hex, Base64URL, Lowercase, Digits, or Custom character sets.

How to Use Random String Generator Step by Step

  1. Set Length (1–256) and Count (1–200).
  2. Choose a Character Set (`Hex`, `Base64URL`, `Alphanumeric`, etc.) or supply your own Custom Alphabet.
  3. Click Generate Strings and inspect the theoretical entropy per string.

Worked Example

Generate a 256-bit (64-char) hexadecimal webhook secret.

Inputs: Length = 64, Count = 1, Character Set = Hexadecimal (0–9, a–f)

Result: 64 hex characters (~256.0 bits of entropy)

Each hex digit carries 4 bits of entropy (log₂ 16 = 4); 64 digits deliver 256 bits.

Alphabet Entropy & Safe Token Sizing

Entropy equals `length × log₂(uniqueAlphabetSize)`. Using a 16-character hex alphabet needs twice as many characters as a 64-character Base64URL alphabet to hold the same bit strength (`64 hex ≈ 43 Base64URL`).

Common Real-World Uses

  • Creating local webhook signing secrets and CSRF/session test tokens
  • Generating non-predictable coupon or invite codes with custom alphabets
  • Producing random salts or fixtures for automated unit tests

Common Mistakes to Avoid

  • Picking an 8-character lowercase string for an API key (far too short against brute force).
  • Passing ambiguous characters (`0/O/1/l`) into human-typed invite codes (use a Custom Alphabet omitting them).

Supported Formats, Scope & Limitations

Custom alphabets deduplicate repeated characters automatically and require at least 2 distinct characters.

Privacy & Local Processing

Strings generate solely inside your browser and are never transmitted or stored.

Frequently Asked Questions

How long should a webhook or API secret string be?

Aim for at least 128–256 bits of entropy—for example, 32–64 hex characters or 22–43 Base64URL characters.

What happens if I type duplicate letters in Custom Alphabet?

Duplicates are deduplicated automatically before sampling so character weights remain uniform.

Generating RFC-formatted v4 UUIDs specifically? Open our UUID Generator.