A popular .NET library for building strongly-typed validation rules.

NuGet Nuget Build Status

public class CustomerValidator : AbstractValidator<Customer> {
  public CustomerValidator() {
    RuleFor(x => x.Surname).NotEmpty();
    RuleFor(x => x.Forename).NotEmpty().WithMessage("Please specify a first name");
    RuleFor(x => x.Discount).NotEqual(0).When(x => x.HasDiscount);
    RuleFor(x => x.Address).Length(20, 250);
    RuleFor(x => x.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode");

  private bool BeAValidPostcode(string postcode) {
    // custom postcode validating logic goes here

Getting Started

Learn how to install FluentValidation and get started creating validators.

Built-in Validators

A complete list of built-in validators.

Custom Validators

Create custom validators


Translating error messages into other languages


Testing your validation rules

ASP.NET Integration

Integration with ASP.NET Core

Full Documentation

Read the full documentation