Description
idna is a Python library for Internationalized Domain Names in Applications. It converts domain names between Unicode text and the ASCII-compatible form that DNS uses. It implements IDNA 2008 together with the Unicode UTS #46 compatibility mapping, and it is meant to replace the standard library's encodings.idna module, which only follows the older 2003 specification. The encode and decode functions handle whole domain names, while the ulabel and alabel functions work on single labels for more specialised uses. The UTS #46 mapping normalises input first, for example by lower-casing capital letters, before conversion. When decoding for display, the display option leaves any xn-- label that cannot be decoded unchanged, which suits user interfaces. All errors derive from one IDNAError base class, and a command-line tool is included. It installs from PyPI with pip and is useful for Python developers who handle user-entered or international domain names. The source is public on GitHub.…
Highlights
- IDNA 2008 conversion for Python
- UTS #46 compatibility mapping
- Encode and decode whole domain names
- Per-label ulabel and alabel functions
- Command-line tool included
Ratings & Reviews
No ratings yet
Be the first to rate Idna.
People also visit
Tld.js
JavaScript API to work easily with complex domain names, subdomains and…
Idna FAQ
What is idna used for?
Converting internationalised domain names between Unicode text and the ASCII form that DNS uses.
How do I install it?
Install it from PyPI with pip, for example python3 -m pip install idna.
How is it different from the standard library?
The standard library's encodings.idna only implements the 2003 specification. This package implements IDNA 2008 and covers more scripts.
Does it handle capital letters?
Yes. With the UTS #46 mapping, input is normalised first, so an uppercase label is lower-cased before conversion.
What are the best Idna alternatives?
Popular alternatives to Idna include dnspython, Dnspick and Registry. See all Idna alternatives



