Punycode Converter (IDN ⇄ xn--)

Convert an internationalized domain name such as münchen.de to the ASCII form xn--mnchen-3ya.de used by DNS, or decode an xn-- domain back to readable Unicode. Paste whole URLs or email addresses — only the host name is converted. In live mode the direction is picked for you: paste an xn-- domain and you instantly see what it really says.

What is Punycode?

The DNS was designed for host names made of ASCII letters, digits and hyphens. To allow domain names in other scripts — internationalized domain names (IDNs) — each non-ASCII label is converted to an ASCII string with the Punycode algorithm (RFC 3492) and prefixed with xn--. Browsers show the Unicode form in the address bar, but DNS lookups, TLS certificates and server configs use the xn-- form.

Unicode domainPunycode (ASCII)
münchen.dexn--mnchen-3ya.de
bücher.examplexn--bcher-kva.example
españa.comxn--espaa-rta.com
café.frxn--caf-dma.fr
ελλάδα.grxn--hxakic4aa.gr
пример.рфxn--e1afmkfd.xn--p1ai

How the conversion works

A domain is split at the dots and each label is handled separately; pure-ASCII labels such as de or com stay as they are. Within a label, Punycode first copies all the ASCII characters (münchen → mnchen), adds a hyphen, and then appends a compact code (3ya) that records which non-ASCII characters to insert and where. Finally xn-- marks the label as encoded: xn--mnchen-3ya.

What does this xn-- domain say?

If you found a strange xn-- address in a link, an email, a log file or a certificate, paste it into the box above. Any label starting with xn-- is decoded; everything else is left alone. Some examples:

Punycode (ASCII)DecodedScript
xn--mnchen-3ya.demünchen.deLatin with umlaut
xn--besglgen-n0a1p.dkbesøglægen.dkDanish ø and æ
xn--wgv71a119e.jp日本語.jpJapanese
xn--fiqs8s中国Chinese (a top-level domain)
xn--p1aiрфCyrillic (Russia's top-level domain)
xn--mgbh0fb.xn--kgbechtvمثال.إختبارArabic (IANA test domain)
xn--ls8h.la💩.laEmoji

Why does my browser show xn-- instead of the real name?

Browsers normally display internationalized domains in Unicode, but switch to the raw xn-- form when a name looks risky — for example when it mixes scripts (Latin and Cyrillic in one label) or contains characters that are easy to confuse with ASCII letters. Chrome, Firefox and Safari each have their own display rules for this. Seeing xn-- in the address bar is therefore a hint to look at the decoded name carefully before you log in or pay.

Punycode in URLs and email addresses

Punycode only applies to the host name. The path and query string of a URL use percent-encoding instead, so https://bücher.example/straße is sent as https://xn--bcher-kva.example/stra%C3%9Fe. In an email address only the domain after @ can be converted to Punycode; a non-ASCII local part (before @) needs a mail system that supports internationalized email (SMTPUTF8, RFC 6531).

When you need the xn-- form

  • DNS records (A, AAAA, CNAME, MX, TXT) at your registrar or DNS provider
  • TLS/SSL certificate requests (the CSR's Common Name and Subject Alternative Names)
  • server_name in nginx or ServerName in Apache
  • Mail server settings, allow lists and application config files
  • Older software and APIs that reject non-ASCII host names

Convert in code

LanguageTo ASCIITo Unicode
JavaScript (browser)new URL('https://münchen.de').hostname—
Node.jsurl.domainToASCII('münchen.de')url.domainToUnicode(s)
Python'münchen.de'.encode('idna')b'xn--mnchen-3ya.de'.decode('idna')
Goidna.ToASCII(s)idna.ToUnicode(s)

Python's built-in idna codec implements the older IDNA2003 rules; the third-party idna package implements IDNA2008. Go's package is golang.org/x/net/idna.

Frequently asked questions

What happens to uppercase and full-width characters?

Domain names are case-insensitive, so each label is lowercased before conversion (MÜNCHEN.DE → xn--mnchen-3ya.de). Full-width letters and digits are normalized to their ASCII forms (Unicode NFKC) first.

Is the path of a URL converted too?

No. Only the host name is converted to Punycode. Non-ASCII characters in the path or query string are percent-encoded instead — for example ü becomes %C3%BC. Use the URL encoder for that part.

What is an IDN homograph attack?

Many characters in different scripts look identical — Cyrillic а and Latin a, for example. Attackers register look-alike domains to imitate real sites in phishing links. The Punycode form exposes the trick: аррӏе.com spelled with Cyrillic letters is really xn--80ak6aa92e.com. Modern browsers display the xn-- form for domains they consider confusable, and converting any suspicious link here shows whether it contains non-ASCII characters.

Why does straße.de give a different result elsewhere?

This tool, like Node.js's url.domainToASCII, follows IDNA2008 and keeps ß: straße.de → xn--strae-oqa.de. Older IDNA2003 implementations (including Python's built-in codec) map ß to ss and produce strasse.de.