Punycode Converter

Enter one domain label to encode to Punycode.

How it is calculated

The tool encodes one domain label with the RFC 3492 bootstring algorithm. It first splits the text into Unicode code points. The ASCII characters are copied to the output in order, followed by a hyphen. Then each non-ASCII character is recorded as a number that says how far it is from the previous position, written in a variable-length base-36 code (letters a–z, digits 0–9). The whole result gets the prefix xn--. A label made only of ASCII is returned unchanged with no prefix. The tool also shows how many characters are ASCII and the total character count. It only encodes: it does not decode, does not lowercase letters and does not split a full domain at the dots.

Worked example

Take the label münchen. It has 7 characters, of which 6 are ASCII (m, n, c, h, e, n), so the output starts with mnchen followed by a hyphen. The single non-ASCII character is ü, code point 252. Its position and distance from 128 turn into the number 869, which is written in base 36 as the digits 3, y and a. The tool then adds the prefix and returns xn--mnchen-3ya. This is the ASCII form that DNS uses for the name, while browsers show it back as münchen.

Try this example →

Common mistakes

  • Pasting a whole domain such as münchen.de. The dot is treated as a normal character of the label, so the result (xn--mnchen.de-q9a) is not a valid domain form; encode each label separately and join them with dots.
  • Entering upper-case letters and expecting lower-case output. The tool does not normalise case, so MÜNCHEN gives xn--MNCHEN-psa, while the registered name is lower-case; type the label in lower case.
  • Expecting the xn-- prefix for plain ASCII. A label like example is returned unchanged because it needs no encoding.
  • Using the tool to decode an xn-- name back to Unicode. It only encodes.

About this calculator

Domain names were originally restricted to ASCII characters, which left no room for the world’s non-Latin scripts. Punycode, defined in RFC 3492, solves this with a “bootstring” algorithm that encodes any Unicode label — say, a domain name containing Turkish, Arabic or Chinese characters — into an ASCII-only string prefixed with xn--, which browsers and DNS servers then decode back to the original Unicode text.

This is the mechanism behind every internationalized domain name (IDN) you see redirect to an “xn--” address in your browser bar. This calculator encodes a single domain label to its Punycode form, a task that’s useful for domain registrars, web developers and DNS administrators working with non-English domain names and needing to verify or generate the ASCII form manually.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Seeing the xn-- form is a useful lookalike check. The label bücher becomes xn--bcher-kva, which is what appears in DNS records and certificates, and a link whose raw form starts with xn-- deserves a closer look. The tool only encodes and does not decode, and it does not apply the registry rules for allowed characters. Which language or script are your domain names written in?

Popular calculators

All Calculators