--- id: publicsuffixlist version: "1.0.2.20260726" license: MPL-2.0 license_treatment: copyleft maintenance: active --- # publicsuffixlist — publicsuffixlist implement License: copyleft · Maintenance: active · Downloads: 1.8M/mo ## What it is and what it does publicsuffixlist is a pure-Python parser for the Public Suffix List, a Mozilla-maintained registry of domain suffixes (like .com, .co.uk, and many others). It determines what portion of a domain name is the public suffix and what portion is privately registrable—useful for cookie handling, domain validation, and security contexts where you need to know the "effective" domain of a given hostname. The package ships with a built-in, daily-updated PSL file and supports both Unicode and Punycode-encoded internationalized domain names (IDNs). It has no external dependencies, installs as a wheel, and includes an updater script if you need to use a custom PSL file. The API is straightforward: call `publicsuffix()` to get the longest public suffix, `privatesuffix()` to get the shortest registrable domain, and helper methods like `is_private()` and `subdomain()` for common tasks. Use it for: - Determine the registrable domain from a URL to enforce same-site cookie policies or security boundaries. - Extract the effective domain from a list of hostnames for analytics or logging aggregation. - Validate whether a given domain is a known public suffix (e.g., to reject registrations at the TLD level). - Handle internationalized domain names in Unicode or Punycode form without manual encoding logic. - Parse domain hierarchies to identify subdomains and their relationship to the registrable domain. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses the Public Suffix List to extract the public and private (registrable) portions of domain names, with support for internationalized domain names and Punycode. Yes. The package is actively maintained, has zero known vulnerabilities, installs with no friction, and solves a well-defined problem that many applications need. The copyleft license (MPL 2.0) is permissible for most use cases as long as modifications are disclosed. Install it if you need reliable public suffix parsing; the daily-updated built-in list and pure-Python implementation make it a practical choice. ## Install pip install publicsuffixlist uv add publicsuffixlist poetry add publicsuffixlist ## Installing publicsuffixlist Before you install: Low friction: pure Python with no runtime dependencies, distributed as a wheel. Actively maintained with a release 19 days ago; last commit on 2026-07-26. Dropped Python 2.7 and 3.4 support at version 1.0.0 in June 2024. License in practice: Licensed under Mozilla Public License 2.0 (copyleft). Requires derivative works and modifications to be disclosed under the same license; permissible for proprietary use if license terms are respected. Quickstart: from publicsuffixlist import PublicSuffixList psl = PublicSuffixList() print(psl.publicsuffix("www.example.com")) # "com" print(psl.privatesuffix("www.example.com")) # "example.com" Requires Python 3.5 or later; Python 2.7 and 3.4 are no longer supported. Verify before relying: - Whether the built-in PSL file is updated daily as claimed, or how frequently updates occur in practice. - Performance characteristics when parsing very large domain lists or with deeply nested subdomains. ## Package facts - License: MPL-2.0 (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags public suffix list parser, domain name parsing, extract registrable domain, IDN domain handling, TLD extraction, punycode domain support, domain suffix lookup, domain-parsing, internationalization, security-boundary [View on SkillFed](https://skillfed.io/packages/publicsuffixlist) · [View on PyPI](https://pypi.org/project/publicsuffixlist/)