Xerobit

Punycode Converter: Domain Name Encoding and Decoding

Enter a Unicode domain name to encode it into Punycode, or paste an xn-- Punycode string to decode it back to readable characters. This punycode converter processes each dot-separated label according to RFC 3492 and runs entirely in your browser without uploading any data.

Paste a Unicode domain to encode, or an xn-- Punycode domain to decode.

Result

How to use the punycode converter

  1. Paste your Unicode domain name or xn-- Punycode string into the text area.
  2. Select Encode to Punycode, Decode from Punycode, or leave it on Auto-detect.
  3. The result updates instantly as you type, showing the converted domain.
  4. Copy the output for use in DNS records, browser testing, or configuration files.

How Punycode encoding works

Punycode is defined in RFC 3492 as a way to represent Unicode strings using only the ASCII characters allowed in DNS hostnames. The algorithm separates a label into basic (ASCII) code points and non-basic code points. Basic characters are copied directly to the output. If any non-basic characters exist, a hyphen is appended after the basic characters, followed by a base-36 encoded representation of the non-basic characters.

The encoder inserts non-basic characters one at a time in order of their code point value. It uses a generalized variable-length integer scheme with three parameters: base = 36, tmin = 1, and tmax = 26. A bias adaptation function keeps the encoded digits compact. For example, the label münchen has six basic characters (mnchen) and one non-basic character (ü, U+00FC). The basic part becomes mnchen-, and the insertion of ü at position 1 is encoded as 3ya, yielding mnchen-3ya.

Common Punycode examples

This table shows how several internationalized domain labels convert between Unicode and Punycode. Each row represents a single label; dots separating labels are preserved exactly as typed.

Unicode LabelPunycode LabelLanguage / Script
münchenxn--mnchen-3yaGerman
caféxn--caf-dmaFrench
日本xn--wgv71aJapanese (Kanji)
москваxn--80adxhksRussian (Cyrillic)
例えxn--r8jz45gJapanese (Kanji)
straßexn--strae-oqaGerman

Per-label processing in domains

A fully qualified domain name consists of labels separated by dots. The Internationalized Domain Names in Applications (IDNA) standard applies Punycode to each label independently. If a label contains only ASCII characters, it is left unchanged. If it contains any non-ASCII characters, the entire label is encoded and prefixed with xn-- to signal to DNS resolvers that the label is Punycode-encoded.

For instance, the domain café.example.com has three labels. Only café requires encoding, so the result is xn--caf-dma.example.com. When decoding, this punycode converter checks each label for the xn-- prefix and decodes only those that have it, leaving pure ASCII labels untouched.

Why browsers and DNS need Punycode

The Domain Name System was originally designed to accept only a limited set of ASCII characters: letters A through Z, digits 0 through 9, and hyphens. To support domain names in languages like Arabic, Chinese, Cyrillic, or accented Latin scripts, the IETF introduced IDNA. Rather than changing the core DNS protocol, IDNA maps Unicode domain names into the existing ASCII namespace using Punycode.

When you type a Unicode URL into a modern browser, the browser converts the domain to its xn-- form before querying DNS. Tools like this punycode converter let developers and system administrators verify what the underlying DNS query will look like, which is essential when configuring SSL certificates, setting up email servers, or debugging routing issues for internationalized domains.

Edge cases and common mistakes

Several edge cases can cause confusion when working with Punycode. First, uppercase and lowercase matter during decoding. While DNS itself is case-insensitive, the Punycode algorithm expects the input to be normalized. Most implementations convert the Unicode string to lowercase (via Nameprep or IDNA2008 mapping) before encoding.

Second, a label that is purely ASCII should never be prefixed with xn--. If you see xn--example, decoding it will likely fail or produce unexpected results because the algorithm expects the base-36 delta sequence after the last hyphen. Third, extremely long Unicode labels can exceed the 63-character DNS limit once encoded. Always check the length of the resulting Punycode label to ensure it fits within DNS constraints.

Finally, mixing directions or combining marks (such as right-to-left Arabic text with diacritics) requires careful Unicode normalization before encoding. Passing unnormalized text may yield different Punycode strings across systems.

This tool lowercases and Unicode-composes (NFC) each label, then applies the RFC 3492 algorithm and checks that decoding round-trips. It does not run the full IDNA/UTS #46 mapping or any registry rules, so characters such as ß are kept as typed (giving xn--strae-oqa, the IDNA2008 form), and it does not decide whether a label is allowed in a given top-level domain. Labels that would encode to more than 63 characters are rejected, and input with a scheme, path or port is refused because only bare domain names are converted.

Worked examples

ExampleInputResult
German umlautDomain or Punycode: münchen.de; Mode: encodexn--mnchen-3ya.de
Japanese domainDomain or Punycode: 例え.jp; Mode: encodexn--r8jz45g.jp
Decode PunycodeDomain or Punycode: xn--mnchen-3ya.de; Mode: decodemünchen.de
Mixed labelsDomain or Punycode: café.example.com; Mode: encodexn--caf-dma.example.com

FAQ

What is a punycode converter used for?

A punycode converter translates internationalized domain names containing Unicode characters into the ASCII-compatible format required by DNS, and vice versa. It is used by developers and administrators to configure domains, SSL certificates, and email servers for non-ASCII languages.

What does the xn-- prefix mean?

The xn-- prefix is a marker added to a DNS label to indicate that the rest of the label is encoded in Punycode. It tells applications that the string should be decoded back into Unicode for display to users.

Can Punycode handle emojis in domain names?

Technically, the Punycode algorithm can encode any Unicode code point, including emojis. However, most domain registries restrict which characters are allowed under IDNA2008 rules, and emoji domains are generally not supported for standard web hosting.

Is my data sent to a server when I use this tool?

No. This punycode converter runs entirely in your browser. The encoding and decoding logic executes locally via JavaScript, and no domain names or strings are uploaded anywhere.

What is the difference between IDNA2003 and IDNA2008?

IDNA2003 used a process called Nameprep to normalize strings before Punycode encoding, which mapped some characters together. IDNA2008 removed Nameprep and uses stricter, protocol-level mappings, meaning some domains valid under IDNA2003 are invalid under IDNA2008.

Why did my Punycode decoding fail?

Decoding fails if the string after the xn-- prefix does not follow the RFC 3492 base-36 encoding rules. Common causes include typos, missing delta values, or attempting to decode a label that was not actually Punycode-encoded.

Does this tool validate that a domain is allowed by IDNA?

No. It performs the RFC 3492 conversion with lowercasing and NFC normalization, and rejects labels longer than 63 characters or Punycode that does not round-trip. It does not apply the full IDNA2008 or UTS #46 rules, so registrars and browsers may still refuse some labels it can convert.