Track Data Parser
Paste track 1 or track 2 data to see its fields. Educational format reference only.
Format reference
- Track 1: starts with %, separator ^, ends with ?. Fields: format code, PAN, name, expiry (YYMM), service code, discretionary.
- Track 2: starts with ;, separator =, ends with ?. Fields: PAN, expiry (YYMM), service code, discretionary.
Related
How this tool works
A magnetic stripe record is written in one of two formats, track 1 and track 2, and both are defined in ISO/IEC 7813. Track 1 uses a different character set and a different separator from track 2, and reading either one is a matter of finding the field separators, stripping the padding characters and reading the fixed-width fields.
Track 2 is the one that matters, because it is the format on every card that has a stripe. It opens with the primary account number, which runs until either a field separator or a pan separator, then the expiry date as four digits in YYMMDD, then a three digit service code, and then discretionary data that runs to the end of the record. The trailing characters may include a four digit PIN block, which is written with a special character and reversed, and a track 3 discretionary block.
Track 2 field layout
| Field | Length | Notes |
|---|---|---|
| Primary account number | 1 to 19 | Ends at a field separator or a pan separator |
| Expiry date | 4 | YYMMDD, and 00 means no expiry |
| Service code | 3 | Two digits of interchange and three of authorisation |
| Discretionary data | Variable | May end with a PIN block and a track 3 block |
| Field separator | 1 | Marks the end of the discretionary data |
A separator written as ^ in text is the field separator, and = is the pan separator, which is why a raw record often appears as 4242...=2912101...^...
When to use it
- Read a raw track record and see what each field contains
- Check the service code on a record against the table of what it permits
- Debug a card reader that is producing unexpected values
- Understand what the discretionary data on a record carries
Frequently asked questions
What is track data?
The data encoded on a magnetic stripe, in one of two formats defined by ISO/IEC 7813. It contains the card number, the expiry date, a service code and discretionary data.
Which track is used?
Track 2 on essentially every card with a stripe, and track 1 on some. Track 1 uses a different character set, which is why track 2 is the format you meet in practice.
What are the ^ and = characters?
The field separator and the pan separator. A raw record usually reads 4242...=2912101...^... when the separators are written literally, and many encoders use = and ^ for them.
What does the service code mean?
Two digits governing interchange and three governing authorisation. They determine what the card may be used for, and a record whose service code forbids the intended use should be refused.
Does a parsed track record prove the card works?
No. It shows the structure of the record. Whether the account exists or has funds is a question for the issuer.
Why is the PIN block reversed?
It is written in a reversed, bit-inverted form so that a card-present terminal reading the track can compare it against the keyed PIN without the number being in the clear on the stripe.