A card-number generator creates input for a test. The useful questions are which input contract it enforces, which failures it can deliberately produce and whether a run can be reproduced. None of those operations opens an account or supplies spending power. The test authorization guide covers permission and provider boundaries when fixtures leave an offline harness.

Our tools have different jobs: the network generator follows the shared card profiles; the BIN generator accepts a custom prefix; the bulk generator adds a seed, manifest and negative-case options. Their differences affect test coverage, even though several paths share the same checksum helper.

What does a card number that “works” actually prove?

A real card can be used by its holder or another authorized user under the issuer’s terms. A generated fixture has a different purpose: exercising a particular software check. Use an explicit result label instead of one unqualified “valid” badge.

Result being claimedEvidence neededWhat the result does not prove
Local input acceptedCharacters, selected profile length/prefix and checksum resultsAn issued account, ownership or spending power
Sandbox scenario passedThe documented fixture and expected result in the correct provider test environmentA live payment or an actual available balance
Payment authorizedA trusted provider result matched to the server-owned orderThat funds have been captured or paid out to the merchant
Payment capturedA confirmed capture matched to the expected amount and currencyFinal merchant payout or the absence of a later refund or dispute

Our test-card reference lists selected provider scenarios. If a number passes the local validator but the next layer rejects it, use the test-card failure guide to identify the boundary. For amounts after authorization, the balance and capture walkthrough follows a partial capture and refund.

Not every legitimate payment asks for a newly entered security code: saved-credential and recurring flows have different requirements. A local CVV-shaped string does not supply an issuer secret. Browser validation also needs a corresponding server/provider boundary; accepting a field in the UI is not permission to charge it.

Start with an explicit input contract

The following is the actual prefix-batch function used by the BIN tool. Its complete module supplies the imports and helper functions shown in the downloadable project.

export function prefixBatch(input, length, count, rng = cryptoRandom) {
  const { status, digits: prefix } = normalizeInput(input);
  if (status !== 'ok' || prefix.length > 8) throw new TypeError('Use 1–8 ASCII prefix digits; spaces and hyphens are allowed, other characters are not');
  integer(length, 12, 19, 'Total length');
  integer(count, 1, 25, 'Quantity');
  const records = Array.from({ length: count }, () => {
    const payload = prefix + chars(rng, DIGITS, length - prefix.length - 1);
    return Object.freeze({ number: payload + luhnCheckDigit(payload), prefix, length });
  });
  // Export these records. Do not reread edited controls to describe an older batch.
  return Object.freeze({ prefix, length, records: Object.freeze(records) });
}

The prefix accepts one to eight ASCII digits with the documented separators. Total length must be an integer from 12 to 19, and a batch contains 1–25 records. These are this tool’s limits, not a claim that every prefix/length combination is a supported network card. Each output reserves one final digit for the Luhn checksum.

The previous short example did not enforce those boundaries: a full PAN used as a prefix could gain another digit, and letters could flow into the arithmetic. The replacement rejects those inputs before building a record.

CaseInput / conditionExpected result
validSix prefix digits, total length 16{"length":16,"state":"generated"}
lettersA letter in the prefix{"state":"rejected"}
complete-panFull PAN mistakenly used as a prefix{"state":"rejected"}
fractionNon-integer total length{"state":"rejected"}
zeroZero total length{"state":"rejected"}
test('Prefix generation rejects the old length and malformed-input regressions', () => {
  for (const [prefix,length] of [['4x',16],['4111111111111111',16],['4',16.5],['4',0]]) {
    assert.throws(() => prefixBatch(prefix,length,1,seededRandom('regression')));
  }
  for (const length of [12,16,19]) {
    const batch=prefixBatch('453914',length,3,seededRandom('regression'));
    assert.ok(batch.records.every(row=>row.number.length===length && luhnValid(row.number)));
  }
});

A passing checksum is only one property. Use the validator to inspect the local profile result separately, and the Luhn explanation for the arithmetic. A custom prefix fixture need not match a network at all.

Deliberate invalid data is a useful output

A checkout needs negative cases as well as success-shaped input. The bulk tool can intentionally alter the check digit and mark the record luhnValid: false; it can also create expired-date cases relative to a chosen reference date. Describing every generated record as valid would hide those options.

test('A saved manifest replays deliberate checksum failures exactly', () => {
  const session=bulkSession({seed:'guide-replay',referenceDate:'2026-11-08',mix:'visa',count:4,
    invalidPercent:100,expiredPercent:0},profile);
  const rows=Array.from({length:4},()=>session.next());
  assert.deepEqual(replayBulk(session.manifest,profile),rows);
  assert.ok(rows.every(row=>!row.luhnValid && !luhnValid(row.cardNumber)));
});

This test uses a fixed seed, date and network mix, then recreates the same batch from its manifest. Every record in this particular run is deliberately checksum-invalid. The complete manifest includes generator and profile versions: retaining only the seed is insufficient when the algorithm or network configuration changes.

Use a deterministic seed to reproduce a bug, not as a secret. The normal prefix tool uses browser cryptographic randomness by default; the repeatable examples inject a seeded source. Neither randomness mode proves that a generated number is unassigned. The program does not query issuer records, so it cannot certify absence of collisions.

Choose the right boundary for the fixture

NeedSuitable inputWhat the result establishes
Input grouping and supported lengthsSynthetic local fixtureYour form handles that representation
Checksum error messageExplicit invalid-checksum fixtureThe validation error is reachable
JSON/CSV import or a reproducible batchSaved manifest plus matching generator versionThe same test data can be reconstructed
Provider decline or 3DS challengeProvider-published sandbox scenarioThe configured sandbox follows that scenario
An issued payment instrumentA legitimate issuer relationshipOutside the generator’s capabilities

A provider test card selects behavior in a specific sandbox. A local generated value has no guaranteed provider response. The distinction also applies to “checkers”: this site’s validator performs local format calculations; it does not attempt an authorization or check whether an account is active.

Inspect how the tool runs

Browser-side computation describes the generation step. It is not a promise that an entire web page sends no requests. Open developer tools, inspect loaded resources, then generate a small synthetic batch and observe the Network panel. Distinguish asset downloads, consent-dependent analytics/advertising and any request carrying input. Read the privacy policy for the site’s broader processing.

Optional downloads are useful for an offline test suite. Review the files and entry points before running them; these examples require no payment credentials and make no provider calls. A package or extension should be assessed by its source and requested permissions, not automatically treated as malicious because it is downloadable. Claims of funded or live cards do not follow from the computation shown here.

Run the corrected implementation

Extract the shared source and regression project and use Node.js 22 or later:

node guide-demo.mjs generation-contract
node --test guide-examples.test.mjs payment-guide-examples.test.mjs

The displayed implementation is included in that ZIP, and the published tables are generated from the same JSON cases the tests execute. For larger fixture workflows, continue with test-data management rather than copying a second generation algorithm into your project.

Frequently Asked Questions

Do card numbers that work exist?
Issued cards work for authorized users under their issuer and provider terms. Generated fixtures can pass local input checks or support a documented test, but do not create an account, payment authorization or balance.
What does valid mean for a generated number?
It must be qualified: a value may satisfy a local length, prefix or checksum rule. That does not establish an issued account, ownership, balance or payment acceptance.
Can the generator guarantee a number is unassigned?
No. It computes synthetic fixtures without querying issuer account records. It neither issues accounts nor checks for collisions with real account numbers.
Are downloads always a warning sign?
No. This site provides optional source-code ZIPs and developer packages. Review their origin, contents and permissions. A local fixture project is different from an installer claiming to unlock funded cards.
Does browser-side generation mean the entire site makes no requests?
No. Local computation describes the generator, not every resource on the website. Assets, consent-dependent analytics or advertising can involve network requests; inspect the privacy policy and browser network panel.