Java API for Mozilla's Public Suffix List
Clone or download
Latest commit 452d20c Mar 16, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Implement Mar 16, 2016
.gitignore download PSL via maven Jul 9, 2014
.travis.yml [#4] fix travis configuration Aug 5, 2015
LICENSE changed to WTFP License Aug 23, 2014 Point to new release Mar 16, 2016
pom.xml [maven-release-plugin] prepare for next development iteration Mar 16, 2016

Public Suffix List API

This is a thread-safe Java API for Mozilla's Public Suffix List:

A "public suffix" is one under which Internet users can directly register names. Some examples of public suffixes are .com, and


This package is available in Maven central:



Create a PublicSuffixList with a PublicSuffixListFactory:

  • PublicSuffixList.getRegistrableDomain(): Gets the registrable domain or null. E.g. "" and "" will return "". Null, an empty string or domains with a leading dot will return null.

  • PublicSuffixList.isRegistrable(): Returns whether a domain is registrable. E.g. "" is registrable, "" and "net" are not.

  • PublicSuffixList.isPublicSuffix(): Returns whether a domain is a public suffix or not. E.g. "com" is a public suffix, "" isn't.

  • PublicSuffixList.getPublicSuffix(): Returns the public suffix from a domain or null. If the domain is already a public suffix, it will be returned unchanged. E.g. "" will return "net".

All methods are case insensitive.


You can use the API's methods with UTF-8 domain names or Punycode encoded ASCII domain names. The API will return the results in the same format as the input was. I.e. if you use an UTF-8 string the result will be an UTF-8 String as well. Same for Punycode.


PublicSuffixListFactory factory = new PublicSuffixListFactory();
PublicSuffixList suffixList =;


assertEquals("net", suffixList.getPublicSuffix(""));
assertEquals("net", suffixList.getPublicSuffix("net"));


assertEquals("", suffixList.getRegistrableDomain(""));
assertEquals("", suffixList.getRegistrableDomain(""));
assertEquals("", suffixList.getRegistrableDomain(""));
assertEquals("", suffixList.getRegistrableDomain(""));

assertEquals("食狮", suffixList.getRegistrableDomain("食狮"));
assertEquals("", suffixList.getRegistrableDomain(""));

Public Suffix List update

This library comes with a bundled list which is most likely out dated. You are encouraged to follow Mozilla's Atom change feed and use the latest effective_tld_names.dat. You can specify a custom path to your latest list by setting the property PROPERTY_LIST_FILE:

PublicSuffixListFactory factory = new PublicSuffixListFactory();

Properties properties = factory.getDefaults();
        PublicSuffixListFactory.PROPERTY_LIST_FILE, "/effective_tld_names.dat");

PublicSuffixList suffixList =;

Download Public Suffix List with Maven

You can integrate the download of the latest list in your maven build process:


License and author

Markus Malkusch is the author of this project. This project is free and under the WTFPL.


If you like this project and feel generous donate a few Bitcoins here: 1335STSwu9hST4vcMRppEPgENMHD2r1REK

Build Status