skillfed

tldparse

Parse a given domain and split it into its subdomain, domain and top-level domain parts.

tldparse v1.0.5 101.0K downloads/30d#12,966 on PyPI0
Permissive license MIT DORMANT released

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 tldparse

uv

uv add tldparse

poetry

poetry add tldparse

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: InternetTopic :: Internet :: Name Service (DNS)Topic :: Internet :: WWW/HTTPTopic :: System :: Networking

Tags

domain name parsersplit domain into partsextract tld from domainsubdomain extractionparse fqdntld parsing librarydomain suffix resolver
domain-parsingtld-extraction

More Internet packages