Registry / serialization / tlds
library2026041800pypypi✓ verified 81d ago

Automatically updated list of valid top-level domains (TLDs) sourced directly from IANA. The package provides a simple set and list of all current TLDs. Version 2026041800 is a date-based version reflecting the IANA update date. Released approximately daily.

pip install tlds
INSTALL
IMPORT
SIG · TLDS
T
tlds
serializationpythonv2026041800
Install
1.8s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2026041800 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tld_set
from tlds import tld_set
from tlds import tlds_set

Check if a domain extension is a valid TLD according to IANA.

from tlds import tlds_set, tlds_list print('Number of TLDs:', len(tlds_set)) print('First 5:', list(tlds_set)[:5]) print('Is .com valid?', 'com' in tlds_set)
Debug
Known issues
gotchaThe TLD set is updated daily, so values can change between package versions. Do not rely on a specific version's set for security-critical checks without pinning the version.
fix
Pin the version in requirements.txt: tlds==2026041800
affects: all
gotchaThe set contains only the lowercase version of each TLD (e.g., 'com', not 'COM'). Always lowercase input before checking membership.
fix
Use: domain_extension.lower() in tlds_set
affects: all
gotchaThe set includes IDN TLDs in their punycode form (xn--...). If you expect an internationalized domain name, convert it to punycode before checking.
fix
Use idna package: from idna import encode; encode('münchen').decode() in tlds_set
affects: all
Upgrade
Version history
2026041800latest on PyPI · released Apr 20, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources
tlds — pip install tlds · libregistry