Brand new validator is coming. Subscribe to find out first.

Major brands

It recognises all major card brands: Visa, Mastercard, Maestro, American Express, Diners Club — to name a few. And we’re always looking to add more!

Free forever

jQuery Credit Card Validator is free and we promise you that it’ll stay free. What’s more, we’ll give you free support. Just tweet us or create a new issue on GitHub if you find a problem.

Open source

jQuery Credit Card Validator is MIT-licensed. That means you can do whatever you want with it — use it in commercial projects, modify it, sell it — as long as you include the copyright notice and licence text.

How it works

jQuery Credit Card Validator is written in CoffeeScript
and (surprise, surprise!) is a jQuery plugin. It analyses the card number in the input field on which it was called, and returns an object with four properties:

card_type — an object with the below properties, or null if card type unknown

The plugin uses input event with a fallback to keyup. That means, in most browsers, it will run the callback every time the value changes: regardless of how the change was initiated (keystroke, paste, undo, redo, etc). In browsers that don’t support input event, the callback will be called only when the user releases a key on their keyboard (keyup event).

The value of this inside the callback is set to the input element to which the validator was attached: