tldparse
Parse a given domain and split it into its subdomain, domain and top-level domain parts.
What it is and what it does
TLDParse is a domain name parser that breaks a domain into its three core parts: subdomain, domain name, and top-level domain (suffix). It uses the Mozilla public suffix list to correctly handle multi-part TLDs like .co.uk, and works by parsing from right to left (TLD first) rather than left to right. The library has no external runtime dependencies and supports Python 3.3 through 3.10 as well as PyPy.
You instantiate a DomainResult object with a domain string (with or without a URL scheme or path) and access properties like `.tld`, `.domain`, `.subdomain`, and `.fqdn` (fully qualified domain name). You can also customize parsing behavior by passing a `private` parameter to control whether certain domains like github.io are treated as registrable domains or private suffixes, or by providing your own parser implementation.
Use it for:
- Validate email domains by checking whether they contain subdomains, rejecting registrations from subdomain addresses.
- Extract the registrable domain from a URL to group analytics or logs by the actual domain owner rather than subdomains.
- Identify and separate multi-part TLDs (e.g., .co.uk, .com.au) correctly when building domain-based access controls or filtering.
- Customize TLD handling for internal or private domain suffixes by adding or removing entries from the parser.
- Parse domains from user input in web scraping or security scanning tools to normalize and categorize targets.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses domain names into their constituent parts (subdomain, domain, top-level domain) by working backwards from the TLD, with support for multi-part suffixes like .co.uk.
Yes, if you need reliable domain parsing with multi-part TLD support and can tolerate dormant maintenance. The package is dependency-free, permissively licensed, and marked stable. However, do not use it if you require active bug fixes or expect frequent TLD updates—the repository shows minimal ongoing support.
Install
tldparse on PyPI
pip
pip install tldparseuv
uv add tldparsepoetry
poetry add tldparseInstalling tldparse
Before you install
Low install friction with no runtime dependencies. Dormant maintenance status (last commit 2024-10-25) means bug fixes or updates are unlikely, though the package is marked Production/Stable.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, requiring only attribution and inclusion of the license notice.
Quickstart
pip install tldparse
from tldparse import DomainResult
parsed = DomainResult('https://example.github.io/with/some/path')
print(parsed.tld) # io
print(parsed.domain) # github
print(parsed.subdomain) # example
Verify before relying
- Whether the Mozilla public suffix list bundled with the package is kept current or requires manual updates.
- Performance characteristics ('very fast') compared to other domain parsing libraries in real-world scenarios.
- Whether dormant status means the package will handle edge cases or new TLDs introduced after 2024-10-25.
- Repository activity level (stars, contributor count) and likelihood of future maintenance.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 658 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 100,950/month — #12,966 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tldparse-1.0.5-py2.py3-none-any.whl
Keywords: domain, parser, tld, top-level, domain, subdomain
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
pyfaup-rsParses URLs into components (scheme, host,…
copyleft · top 15,000 on PyPI
tldextractAccurately extracts subdomain, domain, and…
permissive · top 1,000 on PyPI
publicsuffix2Extracts the public suffix and registrable…
copyleft · top 5,000 on PyPI
tldExtracts the top-level domain (TLD) and…
copyleft · top 5,000 on PyPI
fqdnValidates fully-qualified domain names (FQDNs)…
copyleft · top 1,000 on PyPI
tldsProvides a set of valid top-level domains…
permissive · top 15,000 on PyPI
urlextractExtracts URLs from text by locating TLDs and…
permissive · top 5,000 on PyPI
dnstwistGenerates domain name permutations to detect…
permissive · top 15,000 on PyPI
publicsuffixlistParses the Public Suffix List to extract the…
copyleft · top 5,000 on PyPI
whoisRetrieves WHOIS information for domain names by…
permissive · top 15,000 on PyPI