Mastercard Validator
Mastercard numbers — 16 digits, 51–55 and 2221–2720 ranges, Luhn check.
International Validation Generation
How validation works
The validator checks the Mastercard BIN ranges and length, then applies the Luhn checksum.
Install the package
dotnet add package DocumentNumber.PaymentCardNumber.Mastercard.Validator
Validator in C#
using DocumentNumber.PaymentCardNumber.Mastercard.Validator;
var validator = new MastercardPaymentCardValidator();
var isValid = validator.Validate("5375718830831320");
Console.WriteLine(isValid ? "Valid" : "Invalid");
Live example
5375718830831320 — a real Mastercard value accepted by the validator
Try Mastercard validation
Runs the exact same library code your application uses. Nothing you enter is stored.
Frequently asked questions
What is Mastercard?
Mastercard numbers — 16 digits, 51–55 and 2221–2720 ranges, Luhn check.
How does Mastercard validation work?
The validator checks the Mastercard BIN ranges and length, then applies the Luhn checksum.
How do I install the Mastercard validator package?
dotnet add package DocumentNumber.PaymentCardNumber.Mastercard.Validator
Is the value I enter in the demo stored?
No. Demo inputs are processed in memory for the current request only and are never persisted or shared.