Random String Generator

Generate secure random strings by exact character count or random byte length.

Runs in your browserFree
Random string options

Choose 1 to 65,536 characters. The result has exactly this many Unicode code points.

Each character is selected independently from the chosen alphabet. Base64 alphabets are not byte encodings in this mode.

Choose your options and generate a string.

Uses cryptographically secure randomness. Runs entirely in your browser; nothing is uploaded or saved.

How to use

  1. Choose Exact character count for a fixed-length string, or Random byte count for a specific amount of random data.
  2. Enter a whole-number length from 1 to 65,536.
  3. Choose an output format. Character mode supports alphanumeric, hexadecimal, Base64 and Base64url alphabets, or a custom alphabet. Byte mode supports hex, Base64, and Base64url encodings.
  4. Choose Generate string, or press Enter while editing an option.
  5. Choose Copy result when ready. Clear removes the output and custom alphabet from the page.

Worked example

For a URL-safe token with 256 random bits, choose Random byte count, enter 32, and select Base64url. The output will contain 43 characters with no = padding. Its value changes on every generation.

For an exact 20-character identifier using letters and numbers, choose Exact character count, enter 20, and select Alphanumeric. One possible result shape is aB7dE2gH9jK4mN6pQ8sT; this example is public and must not be used as a secret.

Characters, bytes, and security

Character mode samples each position independently and uniformly from the chosen alphabet. It does not guarantee that every character group appears; use the password generator if you need that behavior. Duplicate custom characters are removed so they do not skew the distribution.

A character is counted as a Unicode code point. An emoji may occupy more than one UTF-16 code unit, and a visible symbol made from multiple code points counts as multiple characters. Character count is not the encoded UTF-8 byte length.

In byte mode, each byte contributes eight random bits. Hex produces twice as many characters as bytes. Standard Base64 produces 4 × ceil(bytes / 3) characters including padding; unpadded Base64url produces ceil(bytes × 4 / 3). These encodings represent the same random bytes without increasing their entropy.

In character mode, the Base64 choices are simply 64-character alphabets: the result is not necessarily a valid encoding of whole bytes. Use byte mode when a receiving system expects decodable Base64 data.

Longer strings and larger alphabets increase the space of possible values. Secure randomness alone does not make a short string suitable as a secret, and random generation does not guarantee uniqueness. The size limit keeps generation responsive and fits the Web Crypto per-call byte quota.

Privacy

This tool runs entirely in your browser using cryptographic random values. Nothing you enter or generate is uploaded to any server or stored. Clipboard contents are managed by your device.

Frequently asked questions

What is the difference between character count and byte count?

Character mode selects exactly the requested number of characters from an alphabet. Byte mode generates the requested number of random bytes first, then encodes them. For example, 32 bytes produce 64 hex characters, 44 padded Base64 characters, or 43 unpadded Base64url characters.

Is the randomness cryptographically secure?

Yes. This tool uses Web Crypto getRandomValues and unbiased rejection sampling for character selection. It reports an error if secure randomness is unavailable and never falls back to Math.random. Short strings or small alphabets can still be easy to guess.

Can I use my own characters?

Yes, in character mode. Enter at least two distinct characters in the custom alphabet. Duplicate characters are ignored and spaces are preserved. Length counts Unicode code points, not UTF-8 bytes or visual symbols.

Which format should I use for a token?

Use the format and entropy required by the system consuming the token. Byte mode with 32 bytes provides 256 random bits before encoding. Base64url avoids plus, slash, and padding characters, making it convenient for URLs. Encoding does not add entropy or encrypt the value.

Are my generated strings uploaded or stored?

No. Everything runs in your browser. ToolsLodge does not upload or save the alphabet or output. Copying a result places it on your device clipboard, where other applications or clipboard managers may access it.

Request a tool

What tool do you wish existed?

Only if you want to hear when it's live

Your idea will be reviewed by our team before appearing on the public ideas board. Please do not include sensitive or confidential information.