Home
You Are Here: Home » Identity Fraud, Scams & Money » Encoding Scheme of Mag Stripe Cards

Encoding Scheme of Mag Stripe Cards

e142-aq@hercules.Berkeley.EDU (Alan Nishioka) writes:

> Does anybody know how information is encoded on the magnetic stripe for credit cards, bank cards, my student id, etc.? Any references? A trip to the library and looking thru the reader ‘s guide didn’t get me anywhere.

Well, there’s three tracks (ISO 3554), all 0.110″ wide. The top one is 210 BPI and has 7 bits per chr. (incl. parity). Total 79 alpha-num. chrs. The second track has 75 BPI, 5 bits per chr. (incl. par.) total 40 digits The third track has agian 210 BPI, 5 bits per chr (yeah incl. par.) total 107 digits.

Data is coded reversing the polarity of the magnetic field once or twice in the field for that bit. Since you cannot double of half the speed of the card within the space for 1 bit, it all works.

> I just bought a card reader which had 5 ttl level outputs. Two for each of 2 head tracks and a 5th that goes low when a card is being run thru. The chips don’t seem to be identifiable.

Well, the bad news is that you’ll have to write the decoding software yourself. Not much to it, I did it on a Commodore-64. Our magazine (“Hack-Tic”) printed the full specs on all this in the last issue. —

From ucsd!swrinde!zaphod.mps.ohio-state.edu

> Does anybody know how information is encoded on the magnetic stripe for credit cards, bank cards, my student id, etc.? Any references? A trip to the library and looking thru the reader ‘s guide didn’t get me anywhere.

You’ll want to see the American National Standard X4.16 (which I just happen to have sitting in my lap.) It is available from the

American National Standards Institute, Inc.
1430 Broadway
New York, NY 10018

My version is dated 1983. I suspect it has been superceded by now. It details everything (everything!) you ever could possibly want to know about mag stripe encoding for financial services cards.

> I just bought a card reader which had 5 ttl level outputs. Two for each of 2 head tracks and a 5th that goes low when a card is being run thru. The chips don’t seem to be identifiable.

In most all of the MSR’s I’ve taken apart, the chips are custom. One of our vendor’s configurations for the wiring looked like this:

encoding-scheme-of-mag-stripe-cards
You could use a scope to determine which is which — track 2 is recorded at 75 bits/inch while track 1 is 210 bits/inch. Just watch the blinking! The data is self clocking.

mag-stripe-cards
> I discovered that cards seem to use two different levels of stripe, for a total of 4 tracks on my bank card, but only two on my student id, which are at the wrong level for my reader.

Your bank card will typically only use the read-only tracks one and two. Track 3 is a read/write track that has the same electromagnetic properties as track 1, but its usage is not standardized within the industry. Many cards issued today do not even have magnetic media at the location for track 3. (It was originally intended for off-line ATM authorization, but guess what happened to that idea!)

> The code must be self-clocking and I would guess just have simple error checking (parity) since the card can just be run thru again if necessary.

The parity checking is pretty impressive. Track 1 characters are 6 bits plus one (odd) parity bit. There is also an LRC (Longitudinal Redundancy Check) character after the end sentinel character. The LRC bits are parity bits for all the characters in the track such that the total one bits are odd. (The LRC parity bit is simply a parity check on the LRC character.) This scheme protects against almost all random card damage, as you would have to have four bits wrong (the corners of a rectangle, physically) to escape detection. Track 2 parity detection is the same, but track 2 characters are only 4 bits plus one (odd) parity bit.

The character sets are fairly simple subsets of ASCII. Tracks 1 & 3 use this table:

encoding-scheme-mag-stripe

  • For the encoding of data on magnetic stripe cards, these character positions shall not contain information characters (data content).
  • Optional additional graphic.
  • These characters shall have the following meaning for this application:
  • 25 % represents start sentinel.
  • 3F ? represents end sentinel.
  • 5E ^ represents separator.
  • These character positions are reserved for additional national characters when required. They shall not be used internationally.
Track 1 format:

encoding-scheme-of-mag-stripe-card

Notes:

  1. In accordance with the account numbering scheme in ANSI X4.13-1983.
  2. When the primary account number commences with major industry identifier “5” followed by “9”, the encoding of the country in this position is mandatory. In all other situations, the expiration date or separator shall immediately follow the separator that terminates the primary account number. The country code for the United States is 840.
  3. The absolute minimum data encoded in the name field will be a single alpha character in the surname area and the surname separator (/).
  4. The space character is required to separate the logical elements of the name field other than the surname. The separator terminating the name field should be encoded following the last logical element of the name field. If only the surname is encoded, it will follow the surname separator.
  5. In accordance with ANSI X3.30-1971. If no expiration date is associated with the card, a separator shall be encoded. The format for the expiration date is YYMM.

Format Codes C through M. The format codes are reserved for use by ANSI Subcommittee X3B10 in connection with other data formats of track 1.

Format Codes N through Z. Available for use by individual card issuers.

Track 2 uses the following 4 bit character set:

encoding-scheme-of-mag-stripes-cards

Notes:
  1. These characters are available for hardware control purposes and shall not be used for data content.
  2. This character is reserved for future definition in connection with the data format on track 2.
Track 2 format:

encoding-scheme-of-mag-stripe

Notes:
  1. In accordance with the account numbering scheme in ANSI X4.13-1983.
  2. When the primary account number commences with major industry identifier “5” followed by “9”, the encoding of the country in this position is mandatory. In all other situations, the expiration date or separator shall immediately follow the separator that terminates the primary account number. The country code for the United States is 840.
  3. In accordance with ANSI X3.30-1971. If no expiration date is associated with the card, a separator shall be encoded. The format for the expiration date is YYMM.

>BTW, I just want to read, not commit bank fraud 🙂 I would have to build another card input/output assembly for that 🙂

I’ve seen some scams based on ATM card fraud, but it may be tough to fool Mother Visa…particularily when you have to hand your card to a living, breathing human.

Do me a favor and mail me a copy of your interface circuit when you get it working, OK?

-j, now you know all our little secrets, eh?

From ucsd!dog.ee.lbl.gov!pasteur!cory.Berkeley.EDU!

Just got my new California driver’s license. No, I’m not 17, but I take the bus a lot.

It has a holographic plastic laminate of “DMV” and the California Seal.

My color picture was digitized into and IBM computer as was my thumb print and my signature. The mag stripe on the back has three tracks.

Just for fun, I thought I’d try to read it. I had previously been able to read bank cards (with help from sci.electronics). I found that the information encoded is basically just what is printed on the card. Kinda uninteresting. Of course I couldn’t figure out what little extra information was encoded…. (marked unidentified below)

It took me a little while to figure out the format, and I suppose it is documented somewhere (anyone know where?) but it was fun.

Bank Cards — conform to ANSI/ISO 7810-1985 ($10)

Track 1: 6 bit word with 1 bit parity. LSB first. code offset 32 below ASCII code.
Track 2: 4 bit word with 1 bit parity. LSB first. Numbers only.

Driver’s License —

Track 1: 6 bit word with no parity. Otherwise same as Bank Card.
Track 2: Same as Bank Card.

California Driver’s License:

Track 2: (low density)

8 unidentified digits
License Number
Separator
Expiration Date (YYMM)
Separator
Date of Birth (YYYYMMDD)

Track 1: (High density)
DALAN TAKEO NISHIOKA $ 974
TULARE AVE ALBANY
Name (58 characters)
Address (29 characters)
City (13 characters)

Track 3: (High density. Can’t reposition read head. );

Great Western Bank ATM Card:

Track 2:
Account number on the front of the card
Separator
Expiration date (no country code)
Other (propietary) data

Track 1:
Format B
Account number
Separator
Name (from front of card)
Separator
Expiration date (no country code)
Other data

AT&T Universal Card:

Track 1:
Format B
Account Number
Separator
Name
Separator
Expiration Date (YYMM)
6 Unknown chars
Calling Card Number (10 digits)

Track 2:
Account Number
Separator
Expiration Date (YYMM)
3 Unknown chars

Citibank ATM Card:

Track 1:
Format A (proprietary)
Name
Separator
Account Number
Separator
Expiration Date (MMYY)
7 Unidentified chars

Track 2:
Account Number
Separator
Expiration Date (MMYY)
7 Unidentified chars


Leave a Comment

Scroll to top