How to use the Punycode encode / decode tool
- Choose Encode for Unicode to xn-- form, or Decode for xn-- form to Unicode, under Operation.
- Enter a bare host name or an email address in Text or encoded value. Leave out the scheme, path and port.
- Select Convert. Note that the Example button uses Hello, world!, which is plain ASCII and is returned unchanged.
- Read the converted name in the Result box and select Copy.
How Punycode represents Unicode in ASCII
DNS host names are limited to letters, digits and hyphens. Punycode, defined in RFC 3492, is the algorithm that fits any Unicode label into that set. It first copies the ASCII characters of the label in order, adds a hyphen as a delimiter, and then appends a compact code that tells the decoder which non-ASCII characters to insert and where.
That code is a series of numbers written with the 36 symbols a to z and 0 to 9, using variable-length digits so that typical words need only a few characters. The IDNA standards add the prefix xn-- to mark a label as encoded.
Punycode converter examples
In bücher the ASCII letters are copied first, giving bcher. The suffix kva encodes one instruction: insert ü (U+00FC) after the first letter. A label without ASCII characters has no copied part, so everything after the prefix is code.
Only labels that contain non-ASCII characters are changed. The labels example, de and jp below stay as they are, and so does the part of an email address in front of the @ sign.
bücher.example → xn--bcher-kva.example
münchen.de → xn--mnchen-3ya.de
例え.jp → xn--r8jz45g.jp
user@bücher.example → user@xn--bcher-kva.exampleWhat this tool does and does not do
The tool applies the Punycode algorithm to each dot-separated label. It is a converter, not a full IDNA validator, and that has practical consequences.
- Paste the host name only. A full URL is not parsed, so the scheme and path end up inside an encoded label.
- Letter case is preserved and no Unicode normalization or IDNA mapping is applied. Lowercase the name first to match what browsers and registries produce.
- The ideographic full stop and its fullwidth and halfwidth variants count as label separators and become a normal dot.
- Decoding only touches labels that start with lowercase xn--. Other labels, including uppercase XN--, pass through unchanged.
- The 63-character DNS label limit and registry rules about allowed scripts are not checked.
- Whitespace at the start and end of the input is trimmed.
Where you meet xn-- names
You find xn-- names in DNS zone files, TLS certificates, server logs, WHOIS records and mail server configuration, because those systems store the ASCII form. Converting back to Unicode shows what a user would see in the address bar.
The decoded form also matters for security review. Characters from different scripts can look alike, for example the Cyrillic and Latin letter a, so a deceptive domain can imitate a familiar name. Decoding an xn-- label and checking each character exposes such homograph tricks.
Frequently asked questions
What does xn-- mean in a domain name?
It is the ASCII Compatible Encoding prefix from the IDNA standard. A label that starts with xn-- holds Punycode, and software that supports internationalized names decodes it to Unicode for display.
Why does decoding return Invalid input?
The text after xn-- is not valid Punycode. Common causes are a truncated label, a typo in the suffix, or non-ASCII characters mixed into a label that already has the prefix. Check that you copied the whole label.
Can I convert a whole URL?
Not directly. The tool splits its input at dots and does not parse URLs, so https:// and any path become part of the labels and the output is wrong. Extract the host name, convert it, and put it back into the URL.
Is Punycode the same as IDNA?
Not quite. Punycode is the encoding algorithm from RFC 3492. IDNA, in RFC 5890 and its companions, is the framework that says which characters are allowed and that the xn-- prefix is added. This tool implements the encoding step.
How long can a Punycode label be?
DNS limits each label to 63 octets, counted on the encoded xn-- form, and a full name to 253 characters. The tool does not enforce these limits, so check long results yourself.