Punycode / IDN Encoder/Decoder

Convert Unicode domain names to ASCII-compatible xn-- form

Ad placeholder (leaderboard)

Punycode is how the internet fits internationalized domain names into the ASCII-only world of DNS. A name like münchen.example becomes xn—mnchen-3ya.example so it can be looked up, while browsers display the native form. This tool converts Unicode domains to their xn— ASCII form and decodes xn— domains back to Unicode, processing each label per RFC 3490 and RFC 3492.

How it works

The encoding follows the Bootstring algorithm with the parameters fixed for Punycode: base 36, tmin 1, tmax 26, skew 38, damp 700, an initial bias of 72 and an initial code point of 128. It first copies all the basic (ASCII) characters of a label, then encodes the non-ASCII code points by repeatedly finding the next-smallest code point, accumulating a delta, and emitting variable-length digits whose threshold adapts via the adapt function. Decoding reverses this exactly, rebuilding the original code points one insertion at a time.

The IDN layer wraps Punycode: each dot-separated label is examined, and only labels containing non-ASCII characters are encoded and given the xn-- prefix. Pure-ASCII labels and the dots themselves are untouched, which is why a domain like shop.münchen.example only transforms the middle label.

Tips and notes

Use the decode direction as a quick homograph check: paste a suspicious xn— link and see the real Unicode characters, which often reveals a Cyrillic or Greek letter masquerading as a Latin one. When encoding, this tool lowercases labels as IDNA expects; full IDNA2008 also applies Unicode normalization and character mapping, so for production validation pair this with a normalization step.

Ad placeholder (rectangle)