Log in Sign up
Punycode

Convert Unicode to Punycode and decode xn-- domains

DNS stores internationalized domains in xn-- form. Type into the Unicode field to encode a name, or paste xn-- names into the Punycode field to decode them. Put one domain, email address or link on each line. The Check table lists the first 300 lines.

Conversion runs in your browser, domains go nowhere.

Cyrillic top-level domains in Punycode

Seeing xn--p1ai in logs, email or a hosting panel? That is the Russian .рф zone, and the other Cyrillic zones are below. Other scripts work the same way: .中国 is xn--fiqs8s, .みんな is xn--q9jyb4c and the Korean .닷컴 is xn--mk1bu44c.

ZonePunycodeUsed by
.рфxn--p1aiRussia
.русxn--p1acfRussian-language sites
.москваxn--80adxhksMoscow
.детиxn--d1acj3bsites for children
.онлайнxn--80asehdbany site
.сайтxn--80aswgany site
.оргxn--c1avgorganizations
.комxn--j1aefcompanies
.укрxn--j1amhUkraine
.белxn--90aisBelarus
.қазxn--80ao21aKazakhstan
.србxn--90a3acSerbia
.мкдxn--d1alfNorth Macedonia
.монxn--l1accMongolia
Letters of a national alphabet pass through a prism and turn into Punycode

What Punycode is

Hostnames in DNS allow Latin letters, digits and hyphens and nothing else. Your browser turns münchen.de into xn--mnchen-3ya.de with the Punycode algorithm from RFC 3492 and shows the original spelling in the address bar.

The browser encodes each label on its own and adds the xn-- prefix. Latin labels stay as they are: bücher.example.com becomes xn--bcher-kva.example.com. To encode, this converter hands the name to your browser's URL parser and falls back to its own RFC 3492 encoder if the parser rejects it.

Cyrillic а, е, о, р, с and х look identical to Latin a, e, o, p, c and x. Scammers register a domain with one swapped letter and pass it off as a well-known site. The Check column warns when a label mixes scripts, and also when a Cyrillic label consists of look-alike letters alone.

When it helps

  • Your hosting panel, DNS or nginx config only accepts xn--, and your domain has accents or non-Latin letters.
  • An xn-- address turned up in logs or an email, and you want to know what site it is.
  • You check a link from an email for swapped letters.
  • You prepare a domain list for an SSL certificate or a scraper.

What xn-- means: the ACE prefix and label encoding

xn-- is the ACE prefix, short for ASCII Compatible Encoding. IDNA reserves it for encoded labels, so a browser or mail server that meets it treats the rest of the label as Punycode. The encoder copies the plain ASCII characters of a label first and adds a hyphen after them. It then writes the other characters and their positions as base-36 digits, using a to z and 0 to 9. In xn--mnchen-3ya, mnchen holds the ASCII letters of münchen, and 3ya tells the decoder to insert ü after the m. A label with no ASCII characters gets no hyphen: пример becomes xn--e1afmkfd. Chrome and other browsers that follow the WHATWG URL standard keep ß, as IDNA2008 does, so straße.de becomes xn--strae-oqa.de. The older IDNA2003 rules turn the same name into strasse.de.

Homograph attacks: xn-- look-alikes and what the Check column flags

In 2017 security researcher Xudong Zheng registered аррӏе.com, spelled in Cyrillic letters alone. Its Punycode form is xn--80ak6aa92e.com, yet Chrome and Firefox of that year showed it in the address bar as apple.com. Paste it here and the Check column marks it caution: the label is Cyrillic, but every letter looks Latin. A single swapped letter gets a different warning. Type аpple.com with a Cyrillic а and the converter reports that the label mixes Cyrillic and Latin. The look-alike list covers а, е, о, р, с, у, х, і, ј, ѕ, һ, ӏ and three rarer Cyrillic letters. The converter skips the look-alike test under a non-Latin zone such as .рф, where Cyrillic names are normal, and has no look-alike list for Greek. A fine status describes the scripts in the name, so judge the site itself by other signs before you log in.

IDN conversion in Python, Node.js and PHP code

In Python, 'münchen.de'.encode('idna') returns b'xn--mnchen-3ya.de', and .decode('idna') reverses it. That built-in codec follows IDNA2003 and turns ß into ss. The idna package from PyPI follows IDNA2008 through idna.encode() and idna.decode(). In Node.js, url.domainToASCII('münchen.de') returns xn--mnchen-3ya.de, and url.domainToUnicode() decodes. In PHP with the intl extension, call idn_to_ascii('münchen.de', IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) and idn_to_utf8() for the way back. Paste a few of your names into this page to compare its output with your code.

Questions and answers

01What does xn-- mean in a domain?

It marks a label encoded in Punycode. Everything after xn-- is the encoded text. One label you may see in logs is xn--p1ai, the Russian .рф zone: xn--e1afmkfd.xn--p1ai reads as пример.рф.

02How do I put an IDN domain into nginx or DNS?

Use Punycode in configs: server_name xn--mnchen-3ya.de; and the same name in the DNS zone. Browsers convert the address both ways by themselves.

03Can I convert an email address to Punycode?

The domain after @ converts like any other. The mailbox name before @ stays as it is: only servers with SMTPUTF8 accept non-Latin letters there.

04Is a Punycode link safe, and how do I spot a homograph domain?

Every internationalized domain uses the xn-- form, so the prefix alone tells you nothing about a site. Paste the link here. A Cyrillic а in place of a Latin a shows up as a mixed-script warning, and a label made of look-alike letters alone gets its own warning.

05Why does the browser show a domain as xn-- instead of letters?

Chrome and Firefox show Punycode when a label mixes scripts in a way their spoofing rules forbid. Chrome also shows xn-- for a label in another alphabet whose letters all look Latin, as with аррӏе.com under .com. A name written in one script without such tricks shows as letters: пример.рф displays in Cyrillic.

06How do I convert an xn-- domain back to readable letters?

Paste it into the Punycode field. The Unicode field fills in as you type, and Latin labels pass through unchanged. If you paste a single line, the page also stores it in the address bar as ?q=, so you can send the link to a colleague. A line the converter cannot decode gets the error status in the Check column.

07How long can a Punycode label be?

63 characters per label, xn-- included, and 253 for the whole name. The limits apply to the encoded form, which runs longer than the Unicode spelling: пример has 6 letters, xn--e1afmkfd has 12. The converter does not check length, so count the characters in the Punycode field before you register a name or issue a certificate.

08Can I register an emoji domain, and what does it look like in Punycode?

A few country zones such as .ws and .to accept emoji. IDNA2008 forbids them, and .com or .org will refuse the registration. The converter encodes emoji like any other character: 💩.la becomes xn--ls8h.la, and xn--ls8h.la decodes back. The Check column judges letters, and on an emoji line it shows the note meant for accented Latin letters. Ignore that note.

Pricing Grab a free hour