If you have ever built a checkout form, you have probably shown a Visa or Mastercard logo as the user types. That logo comes from the first few digits of the card number: the **BIN** , or Bank Identification Number. This post covers what a BIN tells you, how to detect the brand and validate a number in a few lines of JavaScript, and what you are allowed to keep. ## What a BIN is The first 6 to 8 digits of a card number identify the institution that issued it. The standard (ISO/IEC 7812) cal...