$9 USD once · Both downloads included · No subscription
GetDomainLists
Guide · published 16 October 2026

Filter a domain list by TLD

Keep the names under one ending, or count the names per ending, while streaming a gzip list. The same commands work on a free 1,000-name sample and on the full files.

Tools
gzip, grep, awk

or Python 3 without packages

Memory
Small

the file is read once, as a stream

Check
TLD counts

full-file counts to compare against

A TLD is the last label of a name: io in api.example.io, and uk in example.co.uk. Filtering by TLD therefore keeps example.co.uk under .uk; to keep only .co.uk, filter on that whole suffix instead.

Try it on a free sample

The free .ai sample holds 1,000 registrable domains under .ai:

curl -fsSL https://getdomainlists.com/samples/getdomainlists-ai-domains-sample.txt -o ai.txt
grep -c '\.ai$' ai.txt

It prints 1000: every line ends in .ai.

Keep one ending from a gzip file

The files are gzip-compressed plain text with one lowercase name per line, so a stream keeps memory small:

gzip -dc domains.txt.gz | LC_ALL=C grep '\.io$' > io-domains.txt
wc -l io-domains.txt

On the domains file of the current release this gives 1,129,993 lines, the .io row of the TLD counts. Several endings at once: grep -E '\.(io|ai|dev)$'. Run the same command on the subdomains file to keep the hostnames under an ending.

Count the names per ending

gzip -dc domains.txt.gz | awk -F. '{n[$NF]++} END {for (t in n) print n[t], t}' | sort -rn | head -20

awk keeps one counter per ending (1,339 in the current domains file), not the names, so memory stays small. The first line is .com with 133,023,958 names.

The same in Python

The public toolkit has scripts/filter_tld.py, which reads plain text or gzip as a stream:

python3 scripts/filter_tld.py domains.txt.gz .io > io-domains.txt

Understand the result

A count describes the names in a historical file, not the size of a registry, and coverage is uneven across endings. A name in the output is not evidence that it is registered, resolves or hosts a website today.

Try the format first with the free 1,000-name samples. Both full files are $9 once, with 30 days to download.

Counts for every ending are on the TLD list with a free CSV; names in non-Latin scripts are covered in the analysis of internationalized names.