ShotMark
Skip to Content

Random String Generator

Generate random strings with configurable alphabet and length.

Options

What is Random String Generator?

A random string generator is a tool that produces strings of a chosen length from a configurable alphabet, such as alphanumeric, hexadecimal, base62, or any custom character set you supply. Random strings are the backbone of session IDs, short URLs, file names, invitation codes, and any identifier that must be unguessable without being permanently unique.

This random string generator draws characters using a uniformly distributed selection over the chosen alphabet and runs entirely in your browser. Developers building share links, QA engineers seeding test data, and ops teams labeling resources use it whenever a system needs a short, opaque token that does not have to follow the UUID format.

Why use a random string generator?

  • Mint short, URL-safe IDs. Base62 and alphanumeric strings fit in URLs without percent-encoding, which is friendlier than UUIDs for share links and invitation codes.
  • Match a specific length budget. Custom-length output suits database columns, QR payloads, and SMS codes where a fixed-width field is required.
  • Tailor the alphabet to context. Use hex for cryptographic salts, base62 for share slugs, or a custom alphabet that excludes look-alikes like 0, O, 1, and l.
  • Generate in bulk. Produce up to 100 values per click to seed test users, fixtures, or staging data without scripting.
  • Stay private. Every value is generated locally in your browser; no network call is made and the strings are not logged.

How to use the Random String Generator

  1. Pick an Alphabet Preset: alphanumeric, hex, base62, or custom.
  2. If you chose custom, type the characters to draw from into the Custom Alphabet field.
  3. Set the Length for each string, from 1 to 256 characters.
  4. Set the Count for how many strings to produce in one batch, up to 100.
  5. Click Generate and copy the result with the per-row icon or the top Copy button.

A batch of three 16-character base62 strings looks like this:

k7QmL2pX9vNtRz4B P3yR8nHfB6jZuVtA W2cE5gKmH8sLdQ1n

Output formats and alphabets

The preset alphabets cover the common cases. Custom mode lets you exclude visually ambiguous characters or include locale-specific glyphs.

PresetCharactersBits per charBest for
alphanumericA-Z, a-z, 0-9 (62 chars)5.95Share slugs, invitation codes
hex0-9, a-f (16 chars)4.00Salts, hashes, low-entropy IDs
base62A-Z, a-z, 0-9 (62 chars)5.95URL-safe IDs, short tokens
customAny characters you supplydependsLook-alike-free codes, locale-specific tokens

To estimate the security of a generated string, multiply length by bits per character. A 32-character base62 string gives about 190 bits of entropy, well above any practical brute-force threshold. For human-friendly codes (gift cards, MFA recovery codes), use a custom alphabet that excludes 0, O, 1, I, and l to avoid transcription errors.

Common use cases

  • Backend developers generating share slugs. Produce short base62 IDs for collaborative documents, like k7QmL2pX9v, so links fit in chat and email cleanly.
  • QA engineers seeding test fixtures. Generate batches of 16-char alphanumeric IDs to populate test rows with unique, opaque identifiers.
  • Security engineers minting salts. Use 32-char hex output as a cryptographic salt for password hashing or token signing.
  • Ops teams labeling temporary resources. Tag throwaway cloud resources with a 12-char custom string for quick identification in cost reports.
  • Frontend developers building one-time codes. Mint 8-char codes for OTP-style verification flows or recovery emails.

Frequently asked questions

How random are the generated strings?

The generator selects each character uniformly from the chosen alphabet using Math.random, which is suitable for non-cryptographic use cases like share IDs and test fixtures. For cryptographically random tokens (session IDs, password salts), use a tool that calls crypto.getRandomValues or generate on the server with a dedicated crypto library.

What length should I use?

For unguessable IDs, target at least 80 bits of entropy. With a base62 alphabet (5.95 bits per char), that means 14 characters or more. Add length if the IDs will live in a public namespace where brute-force enumeration is cheap.

Can the same string be generated twice?

In theory, yes. In practice, a 16-character base62 string has 62^16 (about 4.8 x 10^28) possibilities. Generating one duplicate becomes likely only after producing trillions of values. For practical workloads, treat each output as unique.

What is the difference between hex and base62?

Hex uses 16 characters (0-9a-f), so each character carries 4 bits of information. Base62 uses 62 characters (A-Za-z0-9), so each character carries about 5.95 bits. A 16-char base62 string is roughly equivalent to a 24-char hex string in entropy and is significantly shorter for the same security.

Should I use this for passwords?

For end-user passwords, prefer a tool that produces values with mixed character classes including symbols and that draws from a cryptographic RNG. The dedicated password generator is a better fit. For machine-to-machine API tokens, this tool with the hex or base62 preset is appropriate.

Can I exclude characters that look alike?

Yes. Switch to custom mode and paste an alphabet that omits 0, O, 1, I, and l. This is standard for printed codes (gift cards, redemption codes) where humans will type the value back into a form.

Is the output URL-safe?

The alphanumeric and base62 presets are URL-safe and do not require percent-encoding. The hex preset is also URL-safe. Custom alphabets containing ?, #, &, or / will need URL encoding before being placed in a URL.

How many strings can I generate at once?

Up to 100 per batch. For larger volumes, run the same alphabet in a build script using crypto.randomBytes on Node.js or secrets.token_urlsafe in Python.

Like this tool?

ShotMark captures what you do here, in one click.

The traces, payloads, and tests you run by hand? ShotMark grabs the whole bug and hands it to your AI agent.

Private beta accessFounding pricing lockNo spam ever