Track 1 & 2 Generator
Generate ISO 7813 Track 1 and Track 2 magnetic stripe data from card details, with LRC computation and parse mode for decoding existing tracks.
Use test data only. All calculations run locally in your browser — PayProbe never sees, transmits, or stores your PAN, CVV, keys, PINs, or cryptographic inputs. How we handle data →
# Magnetic Stripe Track Generator — Track 1 & Track 2 with LRC
# No external dependencies required
def compute_lrc(data: str) -> str:
"""XOR of all character codes, return as single char."""
result = 0
for c in data:
result ^= ord(c)
return chr(result)
def build_track1(pan: str, name: str, expiry: str,
service_code: str = "101", disc: str = "000000000") -> str:
"""Track 1: %B{PAN}^{NAME}^{EXPYYMM}{SC}{DISC}?{LRC}"""
body = f"B{pan}^{name}^{expiry}{service_code}{disc}"
lrc = compute_lrc("%" + body + "?")
return f"%{body}?{lrc}"
def build_track2(pan: str, expiry: str,
service_code: str = "101", disc: str = "000000000") -> str:
""";{PAN}={EXPYYMM}{SC}{DISC}?{LRC}"""
body = f"{pan}={expiry}{service_code}{disc}"
lrc = compute_lrc(";" + body + "?")
return f";{body}?{lrc}"
# Example
pan = "4111111111111111"
name = "DOE/JOHN"
expiry = "2512" # YYMM
t1 = build_track1(pan, name, expiry)
t2 = build_track2(pan, expiry)
print(f"Track 1: {t1}")
print(f"Track 2: {t2}")
What Track 1 and Track 2 data are
A magnetic-stripe card historically encodes its data on two tracks. Track 1 (alphanumeric, format B) holds the PAN, cardholder name, expiry, and service code; Track 2 (numeric) holds the PAN, expiry, and service code in a more compact form and is the one most payment systems actually read. EMV chip and contactless transactions still carry an equivalent of Track 2 in tag 57, which is why understanding the layout — start sentinel, field separator, service code, end sentinel, LRC — remains relevant well beyond legacy stripes.
This tool builds correctly formatted track strings from synthetic test inputs so engineers can validate parsers, terminal builds, and message construction. The output mirrors the real encoding but is generated from fabricated, non-functional card data — it is not read from any physical card and cannot authorise a payment.
Reading the service code
The three-digit service code is worth knowing: the first digit signals interchange (international vs national, and whether the card is chip-capable), the second authorisation processing, and the third whether a PIN is required and how the card may be used. A service code beginning with 2 or 6 indicates an EMV chip card, which a compliant terminal must process via the chip rather than the stripe.
Use only test data here — never encode or process a real card's track data.