FormatterHQ

Alphanumeric Code Generator

Create letters-and-digits codes for vouchers, booking references, invite links and placeholder usernames with this alphanumeric code generator.

Loading tool…
Ready.

How to use the Random Alphanumeric Generator

  1. Pick the character set: mixed case, uppercase + digits or lowercase + digits.
  2. Set the length of each code (the page starts at 12).
  3. Enter how many codes you need, from 1 to 10,000.
  4. Press Generate, or change any setting to get a new batch straight away.
  5. Copy one code from its box, or use Copy all or Download for the whole list.

What this alphanumeric code generator is for

An alphanumeric code generator produces short identifiers made only of the ASCII letters A–Z and a–z and the digits 0–9: voucher and promo codes, order or booking references, invite tokens, ticket numbers and placeholder usernames. It uses the same secure generator as the Random String Generator, limited to three letters-and-digits character sets. If you need hex, URL-safe characters, symbols or your own alphabet, for example one without look-alike characters, use that page instead.

Choosing between the three character sets

SettingCharactersBits per characterGood for
Mixed case + digitsA–Z, a–z, 0–9 (62)about 5.95Codes only machines read, such as links and API references
Uppercase + digitsA–Z, 0–9 (36)about 5.17Printed vouchers, receipts, codes read over the phone
Lowercase + digitsa–z, 0–9 (36)about 5.17Usernames, subdomains and file names

Mixed case is compact, but be careful where the code will be stored and compared. Many databases compare text case-insensitively by default (MySQL's default collations do), so aB3x and Ab3X count as the same value there, and a unique index can reject a code you believed was new. If codes will be typed or compared without regard to case, generate them with a single case from the start.

Look-alike characters: 0 and O, 1, I and l

This page does not filter ambiguous characters. Here is real output from five uppercase-and-digit codes of length 8:

QW7AORDM
17XL4KY9
1O6DNU2U
91NZC3IX
1RKGFLXE

The third code contains both a 1 and an O, which a customer copying from a receipt can easily confuse with I and 0. Lowercase does not solve the problem either, since l and 1 or o and 0 look alike in many fonts. You have three options:

  • Build an alphabet without the troublesome characters using the Custom setting in the Random String Generator.
  • Follow an established scheme such as Crockford's Base32, which leaves out I, L, O and U and treats I and L as 1 and O as 0 when reading input back.
  • Normalise what people type before checking it: trim spaces, convert to uppercase and map O to 0 if your alphabet only contains the digit.

How long should a code be?

Each character multiplies the number of possible codes by the size of the alphabet, so strength grows quickly with length:

LengthUppercase + digitsMixed case + digits
631.0 bits35.7 bits
841.4 bits47.6 bits
1051.7 bits59.5 bits
1262.0 bits71.5 bits

Two questions decide the length. First, how likely are accidental duplicates? When you issue n codes from N possibilities, you can expect about n²/2N duplicate pairs. For 10,000 codes of six uppercase-and-digit characters that is roughly 0.02, small but not zero. Second, how easy is guessing? With 10,000 valid eight-character codes out of about 2.8 trillion, a single random guess succeeds with a probability of roughly 1 in 280 million, and rate limits on redemption make large-scale guessing impractical.

Formatting codes for people

  • Group long codes into blocks, for example K7QD-M2XP, when you print them. Insert the hyphen in your spreadsheet or code and strip it again before validation.
  • Add a readable prefix such as a campaign or year, and keep the random part long enough on its own.
  • Usernames and handles: lowercase + digits suits temporary account names such as user_x7k2m9. For memorable names made of words, try the Random Username Generator.

How the codes are generated

Every character is chosen independently in your browser from crypto.getRandomValues. Random 32-bit values that would favour some characters are discarded and drawn again, so each of the 36 or 62 characters is equally likely at every position. Codes can be 1 to 10,000 characters long, and each batch holds up to 10,000 codes. Each code appears in its own box with a copy button, Copy all joins the batch with line breaks, and Download saves it as a text file. Duplicates are not removed automatically, so run large batches through Remove Duplicate Lines before importing them.

Frequently asked questions

Does the generator avoid ambiguous characters such as 0 and O?
No. All three character sets include every letter and digit. To drop look-alikes, use the custom alphabet option of the Random String Generator.
Can the same code appear twice in one batch?
Yes, because each code is drawn independently. With long codes it is very unlikely, but remove duplicates before loading a batch into a table with a unique constraint.
Which character set suits printed voucher codes?
Uppercase + digits. People cannot mistype the case, and codes stay readable when printed or read aloud. Mixed case packs more combinations into each character but is easier to get wrong.
Is this the same as the Random String Generator?
It uses the same generator, restricted to three letters-and-digits character sets. The Random String Generator adds hex, URL-safe, symbols and custom alphabets.
Are the codes random enough for real vouchers?
They come from crypto.getRandomValues, a cryptographically secure source. Security also depends on length and on your server limiting redemption attempts.

Last updated September 27, 2026

Related tools