Random String Generator

Generate random strings with full control: length, character classes, count. Uses crypto.getRandomValues (not Math.random) so the output is suitable for tokens, invitation codes, share IDs, or anywhere else you need genuinely random strings.

How to use the Random String Generator

Set length and count. Toggle character classes or paste a custom alphabet to override. Hex only restricts to 0-9a-f — useful for IDs that need to look like hex. URL-safe Base64 alphabet (no + / =) is useful for tokens that go in URLs without encoding.

Generating genuinely random strings

A lot of “random” strings are not: Math.random is unsuitable for tokens, and hand-picked codes are predictable. For invite codes, share IDs, API tokens, or test fixtures you want output drawn from a real cryptographic source, with control over the length and which characters are allowed.

This generates strings using the browser’s crypto.getRandomValues — not Math.random — with toggles for lowercase, uppercase, digits, and symbols, plus hex-only and URL-safe modes and a custom-alphabet override (handy for excluding lookalikes like I, O, 0, and 1). Generate many at once. To build whole records of fake data rather than bare strings, see the random data generator.

Common use cases

  • Tokens and IDs — generate invite codes, share IDs, or API tokens.
  • Test fixtures — produce random strings for tests and seed data.
  • URL-safe values — make tokens that drop into a URL without encoding.
  • Hex identifiers — generate hex-only strings that read like IDs.
  • Unambiguous codes — use a custom alphabet to avoid I/O/0/1 mix-ups.

Frequently asked questions

Is the randomness secure?

Yes. It uses crypto.getRandomValues, the browser’s cryptographic RNG, rather than the weaker Math.random.

What is URL-safe mode?

It uses an alphabet with no +, /, or =, so the string drops straight into a URL without percent-encoding.

Can I exclude confusing characters?

Yes. Paste a custom alphabet — for example one omitting I, O, 0, and 1 — to override the character classes.

Can it make many at once?

Yes. Set the count to generate a batch of independent strings in one go.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: