Nager.PublicSuffix 3.5.0

Nager.PublicSuffix (PSL)

With so many different endings for domain names, it's hard to know if they're valid or not. This project uses a list from publicsuffix.org, which keeps track of all the common endings like .com or .org. It checks domain names against this list to see if they're okay. Then, it splits the domain into three parts: the ending (like .com), the main part (like google), and any subparts (like www). You can find the list on GitHub under publicsuffix list repository.

Use cases

  • Cookie restriction for browsers
  • Domain highlighting in the URL bar of browsers
  • DMARC E-Mail Security
  • Certificate requests (ACME)
  • Determining Valid Wildcard Certificates
  • Two-factor authentication (FIDO)

Code Examples

Analyze a Domain Using a Local Public Suffix List

Use a local public suffix list file to analyze domains

var ruleProvider = new LocalFileRuleProvider("public_suffix_list.dat");
await ruleProvider.BuildAsync();

var domainParser = new DomainParser(ruleProvider);

var domainInfo = domainParser.Parse("sub.test.co.uk");
//domainInfo.Domain = "test";
//domainInfo.FullyQualifiedDomainName = "sub.test.co.uk";
//domainInfo.RegistrableDomain = "test.co.uk";
//domainInfo.Subdomain = "sub";
//domainInfo.TopLevelDomain = "co.uk";

Analyze a Domain Using the Online Public Suffix List

Use a remote source to always work with the latest public suffix list

var ruleProvider = new SimpleHttpRuleProvider();
await ruleProvider.BuildAsync();

var domainParser = new DomainParser(ruleProvider);

var domainInfo = domainParser.Parse("sub.test.co.uk");
//domainInfo.Domain = "test";
//domainInfo.FullyQualifiedDomainName = "sub.test.co.uk";
//domainInfo.RegistrableDomain = "test.co.uk";
//domainInfo.Subdomain = "sub";
//domainInfo.TopLevelDomain = "co.uk";

No packages depend on Nager.PublicSuffix.

Version Downloads Last updated
3.5.0 29 07/07/2025
3.4.0 6 08/11/2025
3.3.0 5 08/11/2025
3.2.0 6 08/11/2025
3.1.0 5 08/11/2025
3.0.1 6 08/11/2025
3.0.0 6 08/11/2025
2.3.0 6 08/11/2025
2.2.2 6 08/11/2025
2.0.3 6 08/11/2025
1.5.1 6 08/11/2025
1.3.1 6 08/11/2025
1.3.0 6 08/11/2025
1.2.2 6 08/11/2025
1.1.1 6 08/11/2025
1.1.0 6 08/11/2025
1.0.3 6 08/11/2025
1.0.0 6 08/11/2025