Public Suffix Lookup
Find the registrable domain for any hostname using a built-in suffix list.
Overview
The public suffix lookup tool finds the "registrable domain" — the part of a hostname that someone can actually buy. Paste any URL or hostname, and the tool returns the public suffix (e.g. co.uk, s3.amazonaws.com), the registrable domain (example.co.uk), and any subdomain prefix.
It is the right tool for engineers writing cookie scoping logic, security analysts checking the eTLD+1 of suspicious URLs, and SaaS teams building tenant-aware routing. Without a public suffix lookup, naive code would think bbc.co.uk is owned by whoever holds co.uk — which is itself a registry, not a registrant.
How it works
The Public Suffix List (PSL), maintained by Mozilla at publicsuffix.org, is a community-curated text file listing every domain under which someone other than the registry controller can register names. The list distinguishes:
- ICANN rules — actual TLDs like
com,org, and country-code chains likeco.uk,com.au. - Private rules — SaaS subdomains where users can register subnames, like
github.io,s3.amazonaws.com,appspot.com. - Wildcards and exceptions — e.g.
*.ckcovers all.cksecond-level domains, while!www.ckexcludes thewwwexception.
The tool walks the labels of the input hostname from right to left, finding the longest matching suffix in the PSL, and returns everything one label deeper as the registrable domain. The result drives correct same-origin policy decisions in browsers and many CDN routing rules.
Examples
Input: www.example.co.uk
Suffix: co.uk
eTLD+1: example.co.uk
Subdomain: www
Input: alice.github.io
Suffix: github.io (private rule)
eTLD+1: alice.github.io
Input: s3.amazonaws.com
Suffix: s3.amazonaws.com
eTLD+1: s3.amazonaws.com (the suffix and the registrable domain coincide)
Input: www.google.com
Suffix: com
eTLD+1: google.com
FAQ
Why does this matter for cookies?
Browsers won't let evil.com set a cookie scoped to com, because that would steal cookies from every .com site. The PSL is what stops bbc.co.uk from setting a .co.uk cookie that would leak to every UK site.
ICANN rule or private rule — does it matter?
For most applications, the union of both is what you want. Some compliance rules care only about ICANN-recognized suffixes; check the spec you are implementing.
What if a domain is not in the PSL?
The tool falls back to assuming the last single label is the public suffix, which is the right behaviour for unrecognized TLDs. Domains that should be in the PSL (new SaaS platforms) can be submitted to Mozilla via a pull request.
Is co.uk really a public suffix?
Yes. The UK registry sells .co.uk names directly, not .uk names (until recently), so co.uk is the eTLD. The PSL captures these jurisdiction-specific quirks.