Card Record Builder

For development and testing only. Generates test card records whose fields follow the ISO/IEC 7812 and 7813 layouts: a Luhn-valid PAN from a published test prefix, a formatted expiry, a brand-appropriate security code and structured cardholder fields. These are not linked to any account and carry no balance.

How this tool works

A card record in ISO/IEC 7812 format is a set of fixed-width fields: the primary account number, the associated data, the cardholder data, the security data, the issuer data and the historical data. Building one means placing the right bytes in the right slots, and the layout is fixed by the standard rather than by convention.

The builder takes the individual fields and assembles them into the binary layout, which is the useful direction when you are working on a reader, a test fixture or a parser, and the reverse of what most people need. A real card also carries discretionary data, a PIN block and a track 3 block, and the size of the record is capped by the track it will be written to.

ISO/IEC 7812 data elements

ElementContents
Primary account numberThe card number, 1 to 19 digits
Associated dataCardholder name, in an ISO 8859-1 string, padded to 26 bytes
Cardholder dataThe PIN block, in a fixed length encoded form
Security dataThe authentication and cryptographic data elements
Issuer dataStart date, expiry date, issuer identifier and discretionary data

The fields are fixed width, so a short name is padded rather than truncated, and the offsets are fixed by the standard.

When to use it

Frequently asked questions

What does a card record builder produce?

A binary record assembled from the individual ISO/IEC 7812 data elements, with the fields placed at their fixed offsets. It is a test fixture and it is not connected to any account.

Which fields are fixed width?

All of them. The primary account number is padded to 19 digits, the cardholder name to 26 bytes, and the dates are 3 bytes each, so a parser can rely on the offsets.

What goes in the issuer data element?

The start date, the expiry date, the issuer identifier and the issuer's own discretionary data, which is where an issuer puts whatever else it needs to carry.

How does this differ from a magnetic stripe record?

A stripe record is a formatted character string, and this is a binary structure. They carry overlapping information in entirely different encodings.

Can I use a built record against a live terminal?

In a test environment only. The record will be read structurally and then declined, because no issuer holds the account.

Related