Internationalized Domain Names and Punycode: A Developer Guide to Unicode URLs
UnicodePunycodeIDNAInternationalized Domain NamesURLsDNSWeb Security

Internationalized Domain Names and Punycode: A Developer Guide to Unicode URLs

UUnicode.live Editorial Team
2026-11-08
7 min read

Learn how Unicode domains become Punycode and how to validate, display, compare, and troubleshoot internationalized URLs safely.

Internationalized domain names let people use familiar scripts in web addresses, but the same domain can appear as Unicode text, an ASCII-compatible Punycode label, or part of a percent-encoded URL. This guide explains how those representations relate and provides a reusable checklist for registering, validating, displaying, comparing, and troubleshooting multilingual domains.

Overview

An internationalized domain name (IDN) is a domain name that contains characters outside the traditional ASCII letters, digits, and hyphen set. A domain such as пример.рф is readable to its intended audience, while DNS workflows commonly represent its labels in an ASCII-compatible form such as xn--e1afmkfd.xn--p1ai. That ASCII form is called an A-label. The human-readable Unicode form is called a U-label.

Punycode is the encoding method used inside IDNA processing to represent non-ASCII label content with ASCII characters. It is not the same thing as URL percent encoding. Percent encoding represents bytes in URL components, usually with sequences such as %20 or %C3%A9. Punycode represents an entire internationalized hostname label and uses the xn-- prefix. Applying URL encoding to a Unicode hostname does not create a valid replacement for IDNA processing.

In practice, an application may encounter all of these forms:

RepresentationExampleTypical purpose
Unicode domain or U-labelmünich.exampleHuman-facing display, search, and address-bar presentation
Punycode or A-labelxn--mnich-kva.exampleASCII-compatible hostname processing and DNS-related interchange
Percent-encoded URLhttps://example/path%20nameEncoding characters in URL paths, queries, and fragments
URIASCII-oriented resource identifierInterchange where an ASCII representation is expected
IRIUnicode-capable resource identifierHuman-readable internationalized links before URL serialization

A reliable workflow keeps the layers separate: parse the URL, process the hostname with an IDNA-compatible implementation, encode URL components according to their role, and apply security checks before displaying or acting on the result. For background on code points and encodings, see Unicode code points vs. UTF-8 and UTF-16 and how to encode and decode URLs with non-ASCII characters.

Checklist by scenario

When registering or configuring a domain

  • Confirm that the registrar and DNS management workflow support the intended script and top-level domain.
  • Record both the Unicode display form and the resulting ASCII A-label form.
  • Check each label separately. IDNA applies to labels, not to the full string as one uninterrupted value.
  • Use the IDNA rules and compatibility behavior required by your registrar, runtime, and deployment environment. UTS #46 processing may be relevant when converting user-facing Unicode input, but it should not be treated as a substitute for understanding the target policy.
  • Test the final domain in DNS configuration, TLS certificate workflows, redirects, email links, and application routing.

When accepting a domain from a user or API

  • Parse the input as a hostname or URL rather than splitting it with a simple string operation.
  • Remove no characters silently. Reject unexpected whitespace, control characters, separators, and hidden formatting characters according to the application's requirements.
  • Convert the hostname through a maintained IDNA-capable library. Do not implement Punycode or IDNA rules from scratch unless you are maintaining a standards-focused component.
  • Validate the normalized result, including label length, allowed structure, and the application's permitted top-level domains.
  • Store a stable comparison form, commonly the canonical ASCII hostname, while retaining the original display form only when there is a clear product reason to do so.
  • Show Unicode when it can be displayed unambiguously and the surrounding context makes the destination clear.
  • Consider showing or exposing the A-label form for unfamiliar, mixed-script, or security-sensitive destinations.
  • Keep the protocol, hostname, port, path, query, and fragment visually distinguishable. A familiar-looking path does not make an unfamiliar hostname safe.
  • Use a trusted URL parser before creating an anchor element, redirecting, or making a network request.
  • For administrative interfaces, logs, and incident reports, preserve an ASCII form so the destination remains searchable and comparable across systems.

When comparing or deduplicating domains

  • Compare hostnames case-insensitively after appropriate IDNA processing; do not compare raw display strings alone.
  • Be explicit about whether a trailing dot is accepted as a fully qualified DNS name or removed for application comparison.
  • Separate hostname comparison from full URL comparison. Paths and queries have different encoding and normalization concerns.
  • Do not assume that visually similar characters represent the same domain. Check scripts, confusables, and restrictions relevant to the application.

What to double-check

Hostname conversion: A URL parser may expose a Unicode hostname for display while serializing it as an ASCII-compatible hostname. Inspect the parsed hostname and serialized URL in the actual browser or runtime used by the product. Do not infer behavior from a copied address-bar string alone.

Normalization: Unicode normalization and IDNA processing address different concerns. Normalizing arbitrary text with NFC, NFKC, or another form does not replace IDNA validation. Apply only the transformations required by the relevant library and policy. The guide to Unicode normalization is useful when diagnosing apparently different text values.

Mixed scripts: A domain containing several scripts may be legitimate, but it deserves additional review. Look for labels that combine scripts unexpectedly, characters that resemble ASCII punctuation or letters, and confusable characters that could mislead users. Use a confusable-detection or display policy where the risk justifies it; do not treat visual similarity as proof of identity. See Unicode security for developers for a broader identifier-safety checklist.

Protocol boundaries: Percent encoding belongs to URL serialization, not to DNS lookup. Encode query parameters with a URL or query-string API, and let an IDNA-aware URL parser handle the hostname. Double encoding can change the destination or produce a string that one component interprets differently from another.

Email and certificates: Email clients, certificate tooling, reverse proxies, and application frameworks may expose different Unicode and ASCII forms. Test the complete path from input to delivery. A domain that resolves correctly in a browser can still fail in an email template, allowlist, certificate request, or log parser.

Common mistakes

  1. Percent-encoding the hostname. Encoding a Unicode hostname as UTF-8 bytes with percent signs is not a substitute for converting its labels to A-labels.
  2. Using a text replacement for Punycode. The xn-- prefix is a result of an algorithm and IDNA processing, not a prefix developers can add manually.
  3. Comparing only what users see. Unicode strings can have different code-point sequences, and visually similar characters can belong to different scripts. Compare a validated canonical form as well as a suitable display form.
  4. Normalizing the whole URL indiscriminately. Hostnames, paths, queries, and fragments have different rules. A transformation that is appropriate for one component may alter another.
  5. Trusting a domain because it contains familiar words. Confusable characters and mixed-script labels can produce misleading visual results. Display and validation policy should account for this possibility.
  6. Testing only one environment. Check the browser, server runtime, reverse proxy, DNS tooling, logging system, and any external API that receives the value.
  7. Discarding the original input without a reason. For support and audit workflows, retaining the submitted value alongside the normalized comparison form can make debugging possible. Protect that data and define retention rules appropriate to the application.

When to revisit

Revisit this checklist before registering a new multilingual domain, migrating a site, changing URL or redirect logic, adding a new script, or introducing a new browser, server runtime, proxy, email provider, or URL library. It is also worth reviewing before seasonal campaigns and other planned traffic increases, when links are copied into new systems and a small parsing difference can affect many destinations.

During a review, test representative U-labels, their A-label equivalents, mixed-script edge cases, invalid labels, trailing dots, ports, paths, query parameters, and internationalized email links. Record the expected result for each component and compare it with the actual result at every system boundary.

A practical final checklist is:

  • Identify whether each value is a U-label, A-label, full URL, URI, or IRI.
  • Parse the URL with a standards-aware library.
  • Process and validate hostnames with IDNA-compatible behavior.
  • Encode paths and query parameters separately from hostname handling.
  • Compare canonical forms, not raw visual strings alone.
  • Review mixed scripts, confusables, hidden characters, and display policy.
  • Test browser, DNS, API, certificate, email, proxy, and logging behavior.
  • Document the expected Unicode and ASCII forms for support and future migrations.

Keeping this distinction between Unicode presentation, IDNA hostname conversion, and URL percent encoding prevents many hard-to-reproduce failures. It also gives developers a consistent way to debug multilingual links as the surrounding tools and workflows change.

Related Topics

#Unicode#Punycode#IDNA#Internationalized Domain Names#URLs#DNS#Web Security
U

Unicode.live Editorial Team

Technical Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.