Punycode is a way to write any Unicode text, such as letters with accents, Cyrillic, Arabic or Chinese, using only the characters the domain name system allows: the letters a to z, the digits 0 to 9 and the hyphen. It's what makes internationalized domain names (IDNs) like münchen.de or 例え.jp work.
When you type such a domain, your browser converts each part that isn't plain ASCII into Punycode and adds the prefix xn--. That prefix tells software "this label is encoded." The domain name system only ever sees the ASCII version.
| What people see | What DNS sees |
|---|---|
münchen.de |
xn--mnchen-3ya.de |
bücher.example |
xn--bcher-kva.example |
mañana.example |
xn--maana-pta.example |
правда.example |
xn--80aafi6cg.example |
例.example |
xn--fsq.example |
Each part of the domain is converted separately. A label that's already plain ASCII, such as de or com, stays as it is.
How the encoding works
You don't need to do this by hand, but the pattern helps you read an xn-- label:
- Copy all the plain ASCII letters in the label, in order.
münchenbecomesmnchen. - Add a hyphen if there were any.
- Add a short code that records which special characters go where. For
münchen, that's3ya: it stands for the ü and its place after the m. - Put
xn--in front:xn--mnchen-3ya.
The encoding itself, Punycode, was published in RFC 3492 in March 2003. The xn-- prefix and the rules for which characters a domain may contain come from the related IDNA standard (RFC 5890).
Where you'll meet each form
In the browser's address bar, you'll usually see the readable Unicode form. Browsers switch to the xn-- form when a name looks risky, for example when it mixes Latin and Cyrillic letters.
In DNS settings, server and certificate configuration, you'll usually need the xn-- form. Many hosting panels convert it for you; if one doesn't accept münchen.de, enter xn--mnchen-3ya.de.
In analytics, logs and some SEO tools, the domain may appear in either form, sometimes both. They're the same site.
In email addresses, support for non-ASCII domains varies between mail providers. Test sending and receiving before you print an IDN address on business cards.
Using an IDN for your site
A domain in the local language and script can be easier for your audience to read and remember, and it matches what they'd type. A few practical points:
- Pick one form for your own markup. Use the same version of the domain in your canonical tags, hreflang annotations, sitemap and internal links, so tools and reports don't treat it as two sites.
- Redirect the variants. If you own both
example.comandéxample.com, redirect the extra one to your main domain with a single redirect, straight to the HTTPS version. Chrome may otherwise show a "Did you mean" warning on the lookalike, and Chromium's own documentation recommends this fix. - Think about typing. People without the right keyboard may struggle to type the special characters. Consider keeping an ASCII domain as well and redirecting one to the other.
- Check every system. Email, payment providers, ad platforms and social networks don't all handle IDNs the same way. Test links and sign-ups before you launch.
For targeting a country, the top-level domain and your international SEO setup matter more than whether the name uses local characters.
Punycode and phishing
Some letters in different scripts look identical. The Cyrillic "а" looks just like the Latin "a," so someone could register a name that reads like a well-known brand but is a different domain. This is called a homograph attack.
Browsers defend against it. Chrome checks each label of a domain and shows the xn-- form instead of Unicode when, among other things, the label mixes scripts in risky ways, is made entirely of letters that imitate another script, or looks like a popular domain. It also shows a full-page warning for some lookalike domains (Chromium). Firefox uses similar rules.
So if you see an address starting with xn-- where you expected a familiar name, that's the browser warning you. Don't sign in there.
To protect your brand:
- Watch for registrations of names that look like yours in other scripts or with accents.
- Consider registering the closest lookalikes yourself and redirecting them to your site.
- Teach your team to check the domain in the address bar, not the text of a link, before entering a password.
Questions people ask
Is Punycode the same as URL encoding?
No. Punycode applies only to the domain name. Non-ASCII characters in the rest of a URL, the path and query, use URL encoding instead, where each byte becomes a % code. So münchen.de/straße becomes xn--mnchen-3ya.de/stra%C3%9Fe.
Can a domain contain emoji?
Punycode can encode emoji: 😉 becomes n28h. But the current IDNA standard disallows symbols, emoji included, in domain names, so most registries won't register them, and Chrome shows such names in the xn-- form. They're a novelty, not a practical choice for a business site.