Package publicsuffix provides a public suffix list based on data from

    A public suffix is one under which Internet users can directly register names. It is related to, but different from, a TLD (top level domain).

    "com" is a TLD (top level domain). Top level means it has no dots.

    "com" is also a public suffix. Amazon and Google have registered different siblings under that domain: "" and "".

    "au" is another TLD, again because it has no dots. But it's not "". Instead, it's "".

    "" isn't an actual TLD, because it's not at the top level (it has dots). But it is an eTLD (effective TLD), because that's the branching point for domain name registrars.

    Another name for "an eTLD" is "a public suffix". Often, what's more of interest is the eTLD+1, or one more label than the public suffix. For example, browsers partition read/write access to HTTP cookies according to the eTLD+1. Web pages served from "" can't read cookies from "", but web pages served from "" can share cookies from "", so you don't have to sign into Google Maps separately from signing into Google Web Search. Note that all four of those domains have 3 labels and 2 dots. The first two domains are each an eTLD+1, the last two are not (but share the same eTLD+1: "").

    All of these domains have the same eTLD+1:

    - ""
    - ""
    - ""

    Specifically, the eTLD+1 is "", because the eTLD is "".

    There is no closed form algorithm to calculate the eTLD of a domain. Instead, the calculation is data driven. This package provides a pre-compiled snapshot of Mozilla's PSL (Public Suffix List) data at




    This section is empty.


      List implements the cookiejar.PublicSuffixList interface by calling the PublicSuffix function.


      func EffectiveTLDPlusOne

      func EffectiveTLDPlusOne(domain string) (string, error)

        EffectiveTLDPlusOne returns the effective top level domain plus one more label. For example, the eTLD+1 for "" is "".

        func PublicSuffix

        func PublicSuffix(domain string) (publicSuffix string, icann bool)

          PublicSuffix returns the public suffix of the domain using a copy of the database compiled into the library.

          icann is whether the public suffix is managed by the Internet Corporation for Assigned Names and Numbers. If not, the public suffix is either a privately managed domain (and in practice, not a top level domain) or an unmanaged top level domain (and not explicitly mentioned in the list). For example, "" and "" are ICANN domains, "" and "" are private domains and "cromulent" is an unmanaged top level domain.

          Use cases for distinguishing ICANN domains like "" from private domains like "" can be found at

          Example (Manager)

            This example demonstrates looking up several domains' eTLDs (effective Top Level Domains) in the PSL (Public Suffix List) snapshot. For each eTLD, the example also determines whether the eTLD is ICANN managed, privately managed, or unmanaged (not explicitly in the PSL).

            See for the underlying PSL data.

            >      is  ICANN Managed
            >   is  ICANN Managed
            >   is  ICANN Managed
            >                  com  is  ICANN Managed
            >  is  Privately Managed
            >             org  is  ICANN Managed
            >                  dev  is  ICANN Managed
            >                  net  is  ICANN Managed
            >             org  is  ICANN Managed
            >  is  ICANN Managed
            >                    com  is  ICANN Managed
            >       is  Privately Managed
            >   is  Privately Managed
            >        such-tld  is  Unmanaged
            >                     org  is  ICANN Managed
            >         is  ICANN Managed
            >   is  Privately Managed
            >  is  Privately Managed
            >                cromulent       cromulent  is  Unmanaged


            This section is empty.

            Source Files