Test card only
Credit Card Number Generator
Generate dummy card details for development and QA. Nothing is stored or sent to a server.
This American Express card generator produces 15-digit, Luhn-valid Amex test numbers with 4-digit CID codes. An Amex card generator is worth having separately from the others for one reason: American Express differs from Visa and Mastercard in almost every dimension except the checksum, and those differences are the most frequently missed details in payment forms.
American Express card number format
| Property | Value | Differs from Visa/Mastercard? |
|---|---|---|
| First digits (IIN) | 34, 37 | Yes |
| Length | 15 digits | Yes — others use 16 |
| Digit grouping | 4-6-5 | Yes — others use 4-4-4-4 |
| Check digit | Luhn (mod 10) | No |
| Security code name | CID (Card Identification Number) | Yes |
| Security code length | 4 digits | Yes — others use 3 |
| Security code location | Front of the card | Yes — others put it on the back |
Six of the seven rows differ. Only the checksum is shared.
Why Amex breaks payment forms
Five failures, in rough order of how often they appear. Each one is reproducible with the generator above.
1. Hard-coded 16-digit length
// Rejects every American Express card ever issued
if (cardNumber.length !== 16) return 'Invalid card number';
Length is a property of the brand, not of cards in general. Derive it from the detected network — 15 for Amex, 16 for Mastercard, 13/16/19 for Visa.
How to test it: generate an Amex number here, paste it into your form, and confirm it is accepted.
2. Fixed 3-digit security code field
A maxlength="3" on the security-code input truncates the last digit of a CID. The card is
valid, the cardholder typed the right code, the payment fails, and nothing on screen
explains why. This is the worst of the five because it is invisible.
const cvvLength = brand === 'amex' ? 4 : 3;
How to test it: generate an Amex card, copy the 4-digit CID, and check that all four digits survive being typed into the field.
3. Wrong input mask
A 4-4-4-4 mask renders a 15-digit number as 1234 5678 9012 345, which is not how the
number is printed on the card. Amex groups 4-6-5: 1234 567890 12345. Users comparing the
screen to the card in their hand will assume they mistyped.
How to test it: generate a number and compare your field’s grouping against the 4-6-5
formatter below.
4. “The 3 digits on the back” help text
The copy and the little card illustration next to the security-code field are wrong for Amex. The CID is four digits, on the front, to the right of the card number. Static help text sends every Amex customer looking at the wrong side of their card.
How to test it: switch your form to Amex and confirm the help text and illustration change with it. The CVV generator produces codes at the right length for each network, and explains why the code cannot be derived from a card number by anyone but the issuer.
5. Brand detection that waits too long
34 and 37 are decisive after two keystrokes. A form that waits for four digits — or for
the field to blur — before showing the Amex mark and resizing the CID field feels broken
even when it eventually behaves correctly.
How to test it: type 37 and confirm the mark appears and the security-code field grows
to four digits immediately.
Amex regex and validation
const AMEX = /^3[47]\d{13}$/;
// Grouping helper: 4-6-5
function formatAmex(n) {
const d = n.replace(/\D/g, '').slice(0, 15);
return [d.slice(0, 4), d.slice(4, 10), d.slice(10, 15)]
.filter(Boolean).join(' ');
}
formatAmex('374245455400126'); // "3742 454554 00126"
formatAmex('378282246310005'); // "3782 822463 10005"
AMEX.test('374245455400126'); // true — 15 digits, 37 prefix
AMEX.test('3742454554001260'); // false — 16 digits
AMEX.test('35282246310005'); // false — 35 is not Amex
The pattern is short because Amex is the simplest network to match: two prefixes, one length, no ranges. Strip separators before testing — it matches digits only, and it checks shape rather than the checksum, so run a Luhn check as well.
American Express product lines
- Green, Gold, Platinum, Centurion — tiers of the same consumer product; all begin
34or37and share the identical format - Corporate and business cards — same format again
- Co-branded cards issued with airline and hotel partners — still 15 digits
There is no product tier encoded in the number. In some markets Amex-branded cards are issued by a local bank under licence rather than by American Express itself, and even then the number format does not change. If you need to know the product or the issuer, that is a BIN table lookup — see the BIN and IIN guide.
Amex acceptance and BIN routing
One structural difference matters for integration work. Visa and Mastercard operate four-party models: they run the network, while banks issue the cards and acquire the merchants. American Express traditionally ran a three-party model in which it is the network, the issuer, and the acquirer at once — though it also licenses issuance to banks in many markets.
The practical consequence is that Amex acceptance is often a separate commercial
arrangement. Some processors require a distinct Amex merchant account, settlement can run on
a different timetable, and your routing logic may need to send 34/37 traffic somewhere
other than the rest. Worth confirming before your first Amex transaction rather than after.
Official Amex test numbers
| This generator | Gateway sandbox card | |
|---|---|---|
| Passes client-side Luhn check | Yes | Yes |
| Triggers Amex brand detection | Yes | Yes |
| Produces a 4-digit CID | Yes | Yes |
| Unlimited unique numbers | Yes | No — a handful of fixed numbers |
| Returns an authorisation response | No | Yes |
| Triggers specific decline codes | No | Yes |
| Works with 3-D Secure flows | No | Yes |
Use this generator while you are fixing the five form problems above; switch to the gateway’s own numbers once the processor’s responses are what you are testing. Stripe and PayPal publish full tables, and we collect the equivalents on the test card numbers reference. Card numbering in general is defined by ISO/IEC 7812.
The other networks have their own pages — Visa, Mastercard, and Troy — while the all-network generator mixes Amex with 16-digit brands in one run, which is the fastest way to prove your form handles both shapes. The tool directory lists everything else, and the FAQ covers what a Luhn-valid number does and does not prove.