On this page
An internationalized domain name (IDN) lets people use characters such as ü in a domain. Behind the scenes, software can represent the internationalized labels in ASCII using Punycode. This article explains how internationalized domain names work, how they differ from URL path encoding, and what website owners should check before deploying one.
Key Takeaways
- IDNA defines rules for processing internationalized domain labels; Punycode is the encoding used in their ASCII-compatible representation.
bücher.examplecan be represented asxn--bcher-kva.example. Each dot-separated label is processed separately.- URL paths and query strings use different encoding rules. Punycode applies to domain labels, not to the entire URL.
- Browsers may display an IDN in Unicode or in its ASCII form, depending on their policies and the name. An IDN is not inherently suspicious.
- Registration rules, browser display policies, and IDNA validity are related but distinct checks.
From Unicode label to ASCII domain
A domain name is made of labels separated by dots. In bücher.example, bücher is a Unicode label and example is an ordinary ASCII label. The following example uses .example, a domain reserved for examples; it is not a claim that the name is registered.
Unicode form: bücher.example
ASCII form: xn--bcher-kva.example
The ASCII form of the first label has the prefix xn--, followed by its Punycode representation. In IDNA terminology, a valid Unicode label is a U-label, and its corresponding ASCII-compatible label is an A-label. The plain ASCII label example does not need Punycode.
Punycode is an encoding algorithm, not a translation of the word or an encryption mechanism. The conversion is reversible for valid labels. IDNA adds rules around which labels are valid and how they are processed; merely adding xn-- to arbitrary text does not make it a valid A-label.
Applications commonly convert an internationalized hostname to its ASCII form before DNS resolution. DNS then looks up the name as usual. Unicode display is a presentation choice made by applications, rather than a separate DNS record type.
Advertisement
IDNA, registration rules, and browser display
Several layers affect whether a particular name works:
- IDNA processing: Software applies applicable mappings and validation rules when converting labels. Not every Unicode character or character sequence is permitted; some rules depend on context or text direction.
- Registry policy: A registry can impose additional restrictions on registrations under its domain, including restrictions related to scripts, languages, or variants. Passing an IDNA conversion does not mean a name is available or registrable.
- Browser display policy: A browser may show the Unicode name, its
xn--form, or another presentation depending on its security policy and the label. Display behavior can differ between browsers and change over time.
Current browser and ICANN documentation could not be retrieved for this article, so it does not assert a current browser-specific display rule or a universal list of permitted characters. Before choosing a name, consult your registry's IDN tables and registration policy, ICANN's IDN guidance, and the documentation for the browsers you support. Test the actual domain in those browsers rather than assuming they will all display it identically.
Length and compatibility
DNS limits each label to 63 octets on the wire and the complete wire-format name to 255 octets, including label lengths and the root. Check these limits after conversion to ASCII: a Unicode label can become longer when encoded as Punycode. Conversion or registration may fail even when the original text looks short.
Also check the ASCII form in the systems that will handle the hostname, including DNS configuration, hosting, certificate issuance, analytics, and redirects. Some interfaces accept Unicode input and convert it; others expect the A-label. Test the actual software and configuration rather than assuming equivalent input handling.
Domain encoding is not path or query encoding
Consider this URL:
https://bücher.example/café?q=naïve
Its hostname contains an internationalized label. Its path and query contain non-ASCII text too, but they are not domain labels. A URL serializer can represent the URL as:
https://xn--bcher-kva.example/caf%C3%A9?q=na%C3%AFve
Here, xn--bcher-kva is an IDNA ASCII label. In the path and query, sequences such as %C3%A9 represent UTF-8 bytes written with percent encoding. Do not apply Punycode to /café or q=naïve.
Percent-encoding rules depend on the URL component and the API used to construct it. Query-string APIs can also apply form-encoding conventions, such as serializing spaces as +. Use a URL-building API instead of manually encoding the whole URL as one string.
Try a conversion in a browser
In a browser's developer console, run:
const url = new URL('https://bücher.example/café?q=naïve');
console.log(url.hostname);
console.log(url.pathname);
console.log(url.search);
console.log(url.href);
The expected serialized values are:
xn--bcher-kva.example
/caf%C3%A9
?q=na%C3%AFve
https://xn--bcher-kva.example/caf%C3%A9?q=na%C3%AFve
This demonstrates URL serialization, not a DNS lookup or a test of how the browser's address bar will display a visited site. The example has not been executed for this article; check the output in your target environment. Conversion can fail for an invalid hostname, so handle errors when parsing user-provided URLs.
Advertisement
Homographs and practical security
A homograph is a name whose characters look like those in another name. Different scripts can contain visually similar characters, and fonts can make distinctions difficult to notice. An attacker could register a misleading name and use it for phishing, subject to the relevant registration rules. This is a visual-confusion risk, not evidence that internationalized names are malicious: IDNs are legitimate and useful for many languages.
Browser display protections can reduce confusion, but they are not a guarantee that every misleading name will be shown as Punycode. For sensitive workflows, users should navigate through a trusted bookmark or established link and verify the expected domain. HTTPS protects a connection to the named host; it does not establish that a visually similar domain belongs to the intended organization.
For applications comparing domains, parse and validate hostnames with a suitable URL or IDNA library, then compare a consistent ASCII representation. Do not rely on visual similarity or raw Unicode string equality alone. If an application fetches URLs, hostname normalization is only one part of its security boundary; destination validation and network controls are also necessary.
Common Mistakes
- Treating every
xn--string as valid. Validate it with an IDNA-aware implementation rather than interpreting the prefix alone as proof of validity. - Assuming all Unicode characters can be registered. IDNA rules and registry policies both matter, and the latter vary by registry.
- Encoding the whole URL with one method. Hostnames, paths, and queries have different rules.
- Relying on address-bar appearance as identity verification. Display policies vary, and lookalike risks remain.
- Checking length before conversion only. DNS limits apply to the encoded labels and full wire-format name.
Best Practices
- Record both the intended Unicode name and its validated ASCII form in deployment documentation.
- Check registration, DNS, certificates, redirects, and browser presentation using the actual target name.
- Test with the languages and scripts your audience uses, including names that may be displayed differently across clients.
- Use maintained URL and IDNA libraries; avoid writing your own Punycode or validation rules.
- Treat email addresses separately: internationalized email addresses have additional compatibility considerations and are not solved merely by converting the domain.
Conclusion
IDNA lets applications handle internationalized domain labels using ASCII-compatible forms, while percent encoding handles non-ASCII data in other URL components. Validate the name against the relevant registry and software, and test both its ASCII representation and its presentation to users.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.