What Is Punycode? IDN Domains and the xn-- Prefix Explained

Last updated: · 5 min read

The Domain Name System traditionally carries only ASCII letters, digits and the hyphen. Domain names that contain accented letters or non-Latin scripts, known as internationalized domain names (IDNs), are therefore converted to ASCII before they reach the DNS. The conversion method is Punycode (RFC 3492), and every converted part of the name is marked with the prefix xn--. Your browser may display münchen.de in the address bar while it actually looks up xn--mnchen-3ya.de. This guide explains how the conversion works, where its limits are and why a name starting with xn-- deserves a careful look. The values in the example are real output from the Punycode Converter.

Formula

A domain name is split into labels at the dots; each label is converted separately.

Encoding (Unicode → Punycode):
  1. Copy the ASCII characters of the label in order
  2. If there were any, append the delimiter "-"
  3. Encode each non-ASCII character, by code point and position, as a number written with the digits a–z and 0–9, and append it
  4. Put the prefix "xn--" in front

RFC 3492 parameters: base 36, tmin 1, tmax 26, skew 38, damp 700, initial bias 72, initial n 128
Limit: at most 63 characters per label

Punycode is the domain-name profile of a general method that RFC 3492 calls Bootstring. ASCII characters stay as they are; the others are expressed as differences computed from their code points, taken in ascending order, and the positions where they must be inserted. Those differences are written as variable-length base-36 numbers. The xn-- prefix is not part of Punycode itself but of IDNA (RFC 5891), where it flags a label as encoded. The tool picks the direction per label: a label starting with xn-- is decoded, a label containing non-ASCII characters is encoded and anything else is left alone. Input is lowercased and normalised to Unicode NFC, and if you paste a URL only the host name is used.

What the inputs mean

Domain name
A name with special characters (such as münchen.de) or its Punycode form (such as xn--mnchen-3ya.de). A full URL starting with https:// works too; path and query are discarded. Spaces and empty labels (two dots in a row) are rejected.

Worked example: Converting münchen.de and back

  1. Input: münchen.de. The name splits into two labels, münchen and de. The second is already ASCII and stays unchanged.
  2. The ASCII letters of münchen are copied in order: mnchen. The delimiter follows: mnchen-.
  3. The remaining ü (U+00FC), together with the fact that it belongs in second position, is turned into a single number and appended as 3ya. With the prefix, the label becomes xn--mnchen-3ya.
  4. Output of the tool: xn--mnchen-3ya.de and Direction: Unicode → Punycode.
  5. In the other direction, entering xn--mnchen-3ya.de returns münchen.de and Direction: Punycode → Unicode.
  6. Names without any ASCII letters have no delimiter part: 日本語.jp becomes xn--wgv71a119e.jp.
  7. A full URL can be pasted: https://www.Bücher.example/katalog?q=1 gives www.xn--bcher-kva.example. Scheme, path and query are dropped and capitals are lowercased.
  8. A look-alike check: аpple.com, where the first letter is the Cyrillic а (U+0430), gives xn--pple-43d.com. The name is visually identical to the Latin apple.com, but its Punycode form shows that it is a different domain.

Result: münchen.de → xn--mnchen-3ya.de (Direction: Unicode → Punycode); xn--mnchen-3ya.de → münchen.de (Direction: Punycode → Unicode).

🌐 Punycode Converter (IDN)

Free, no sign-up; your data stays in your browser.

Open the calculator →

How to read the result

You mostly need the Punycode form in DNS records, server configuration, TLS certificate requests and mail server settings, since many of these systems expect the ASCII form of a domain. The reverse direction is useful for security. Some letters in different scripts look exactly alike, and attackers can register imitations of well-known names that rely on this (a homograph attack). Browsers show labels they consider suspicious, such as mixed-script ones, in their xn-- form. If you spot xn-- in a link, decode it and check which characters it really contains. The tool performs the Punycode conversion only; it does not check whether a name is valid under the IDNA rules or can be registered under a given top-level domain. That is decided by the registry's policy.

Common mistakes

  • Trying to encode the whole domain as one string. Punycode applies to each label separately; the dots stay where they are and only labels with non-ASCII characters receive xn--.
  • Pasting a complete email address. Only the domain after the @ sign is converted to Punycode; the local part is not encoded this way.
  • Measuring the 63-character limit on the readable form. The limit applies to the encoded label including xn--, and it grows with every non-ASCII character.
  • Treating Punycode as encryption or obfuscation. It is a public, reversible encoding and hides nothing.
  • Assuming every xn-- label is malicious, or that every readable name is safe. Legitimate IDNs are common; what matters is which characters the decoded label contains.
  • Overlooking the difference between old and new rules for letters such as ß. The tool encodes ß as it is (straße.de → xn--strae-oqa.de), whereas the older IDNA 2003 rules mapped it to ss, so some software returns a different result.

Frequently asked questions

What does xn-- mean in a domain name?

It is the ACE prefix defined by IDNA. It signals that the rest of the label is a Unicode name encoded with Punycode. Without the prefix the same text is just an ordinary ASCII label.

Why does my browser sometimes show the xn-- form instead of the readable name?

Browsers display labels in Punycode when they mix scripts or could be confused with another name, to protect users from spoofing. The exact criteria differ between browsers.

Do I need Punycode for email addresses?

For the domain part, often yes: mail servers and DNS records such as MX use the ASCII form. The part before the @ is handled by a separate set of standards and is not Punycode-encoded.

Does case matter?

Domain names are case-insensitive. The tool lowercases the input first, so MÜNCHEN.DE and münchen.de give the same result.

Can emoji be used in domain names?

Punycode can encode any Unicode character, so the conversion itself works. Whether such a name can be registered is another matter: the current IDNA rules exclude most symbols, and only a few top-level domains accept them.

Is the domain I enter looked up or sent anywhere?

No. The conversion happens in your browser; the tool makes no DNS query and does not check whether the name is registered.

The result is not exact or binding and is for information only; it is not an official document and cannot be used in official procedures. Confirm it with the competent authority or a professional before acting; no liability is accepted for losses arising from its use.

Sources

Choose your cookie preference to continue

Records the site needs to work (theme, language, favourites) stay in your browser.

This site is free and funded by ads.

With your consent, Google Analytics cookies measure visits and Google AdSense cookies are used to show ads; the data is processed on Google servers abroad.

If you reject, the site works just the same.

Cookie Policy · KVKK notice