domain2idna
The tool to convert a domain or a file with a list of domain to the famous IDNA format.
What it is and what it does
domain2idna is a command-line and library tool that converts domain names and URLs from human-readable Unicode form into Punycode/IDNA format, the standardized ASCII-compatible encoding for internationalized domain names. It reads individual domains, full URLs, or entire files (skipping commented lines starting with #) and outputs the converted results either to the screen or to a file.
The package is designed for domain list and hosts file maintainers who need to normalize international domains for DNS systems or configuration files. It can be used as a standalone CLI tool or imported as a module to integrate domain conversion into other Python applications. With setuptools and colorama as its only runtime dependencies, it installs with low friction and has been actively maintained since 2018.
Use it for:
- Convert a hosts file containing international domain names to IDNA format for DNS configuration
- Batch-process a blocklist of domains with non-ASCII characters before deploying to filtering systems
- Normalize user-supplied domain input in a web application before validation or storage
- Generate Punycode versions of international domains for compatibility with legacy DNS tools
- Maintain parallel lists of human-readable and IDNA-encoded domains for documentation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts domain names and URLs to Punycode/IDNA format, with support for batch processing files and command-line or programmatic use.
Yes. The package solves a specific, well-defined problem (IDNA conversion) with low install friction, permissive licensing, active maintenance, no known vulnerabilities, and a straightforward API suitable for both CLI and programmatic use. Install it if you need to work with internationalized domain names.
Install
domain2idna on PyPI
pip
pip install domain2idnauv
uv add domain2idnapoetry
poetry add domain2idnaInstalling domain2idna
Before you install
Low friction: pure Python wheel with minimal dependencies (setuptools, colorama). Active maintenance with recent commits; last release 202 days ago but repository shows ongoing activity.
License in practice
MIT license (permissive): you can use, modify, and distribute freely with minimal restrictions; include the license and copyright notice in distributions.
Quickstart
pip install domain2idna
from domain2idna import domain2idna
result = domain2idna.convert('münchen.de')
print(result) # Output: xn--mnchen-3ya.de
Requires Python 3.6.2 or later (supports current Python versions up to <4).
Verify before relying
- Whether the package handles edge cases in IDNA conversion (e.g., mixed scripts, invalid domains) as documented
- Performance characteristics when processing very large domain lists
- Whether commented-line filtering works as intended across different file encodings
Package facts
| License | MIT https://raw.githubusercontent.com/PyFunceble/domain2idna/master/LICENSE (permissive) |
| Python support | supports the current Python release (<4,>=3.6.2) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — setuptools, colorama |
| Maintenance | actively maintained — 202 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 110,783/month — #12,445 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: domain2idna-1.12.4-py3-none-any.whl
Keywords: Python, domain, idna
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
idnaConverts domain names between Unicode and…
permissive · top 100 on PyPI
idna_sslPatches Python's ssl.match_hostname to support…
permissive · top 15,000 on PyPI
apeye-coreProvides core offline URL and domain handling…
permissive · top 5,000 on PyPI
publicsuffixlistParses the Public Suffix List to extract the…
copyleft · top 5,000 on PyPI
urlpyurlpy parses, normalizes, and compares URLs…
permissive · top 15,000 on PyPI
publicsuffix2Extracts the public suffix and registrable…
copyleft · top 5,000 on PyPI
PyFunceble-devPyFunceble checks whether domains, IPs, and…
permissive · top 15,000 on PyPI
dnstwistGenerates domain name permutations to detect…
permissive · top 15,000 on PyPI
py2opsinpy2opsin converts IUPAC chemical names to…
permissive · top 15,000 on PyPI
dnspythondnspython is a DNS toolkit that handles…
permissive · top 1,000 on PyPI