Mastercard Generator
Mastercard numbers — 16 digits, 51–55 and 2221–2720 ranges, Luhn check.
International Validation Generation
How generation works
The Mastercard generator builds a structurally valid sample using the same rules the validator enforces — check digits included. Use it for test data and fixtures; never for production records.
Install the package
dotnet add package DocumentNumber.PaymentCardNumber.Mastercard.Generator
Generator in C#
using DocumentNumber.PaymentCardNumber.Mastercard.Generator;
var generator = new MastercardPaymentCardGenerator();
var sample = generator.GenerateDocumentNumber();
Console.WriteLine(sample);
Live example
5375718830831320 — a real Mastercard value accepted by the validator
Try Mastercard generation
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 generation work?
The generator builds a structurally valid Mastercard sample using the same rules the validator enforces — including check digits. Generated values are intended for tests and development only.
How do I install the Mastercard generator package?
dotnet add package DocumentNumber.PaymentCardNumber.Mastercard.Generator
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.