Punycode Converter

Convert Unicode domain labels to xn-- and back, and learn how IDN and emoji domains work. Punycode is encoding, not encryption.

Punycode: the answer in one line

Punycode lets a Unicode domain label travel in ASCII form.

  • Punycode (RFC 3492) is a reversible encoding that represents Unicode hostname labels with letters, digits and hyphens.
  • Under IDNA, an eligible label containing non-ASCII characters is stored in DNS as xn-- plus its Punycode encoding.
  • It is an encoding, not encryption, and not a cipher: there is no secret key.

How to Use Punycode Converter

  1. Enter one or more domain names, one per line.
  2. Choose Encode to convert only labels containing non-ASCII characters.
  3. The component prefixes encoded labels with xn-- and leaves ASCII labels unchanged.
  4. Choose Decode to restore labels that begin with xn--.

Punycode represents Unicode domain labels with basic ASCII using RFC 3492 bias adaptation; dots separate labels and are never encoded.

Examples

Mixed Unicode and ASCII labels:

münich.com

Output:

xn--mnich-kva.com

Two Unicode labels:

例子.测试

Output:

xn--fsqu00a.xn--0zwm56d

By hand: encoding münich

Copy the basic code points first: mnich (5 characters), then the delimiter -. The remaining character is ü, U+00FC (252 in decimal). The encoder starts at code point 128.

delta = (252 − 128) × (5 + 1) + 1 = 744 + 1 = 745

The position adjustment counts the basic characters before the umlaut that have a smaller code point: 1 here. Encode this delta as a generalized variable-length base-36 integer with bias 72. The threshold t determines when to stop; q is the remaining value. For a continuation digit, use t + ((q − t) mod (base − t)), then replace q with floor((q − t) / (base − t)). When q is smaller than t, write q as the final digit. Digit values use a–z followed by 0–9.

kThreshold tq beforeDigitq after
361745k21
72121v0
108260astop

The digits k, v, a form kva. Together with the copied letters and delimiter, the payload is mnich-kva; adding the IDNA prefix gives xn--mnich-kva.

Bias adaptation adjusts the thresholds for the next encoded value using the delta just emitted and the number of code points handled. It damps the first delta more strongly than subsequent deltas, then scales it by the handled count. This encoder trace changes the bias from 72 to 0. There are no more non-basic characters here, so that new bias is not used again.

How IDN domains work

A user types or sees a Unicode name. The application performs IDNA processing and converts eligible non-ASCII labels to the xn-- form before a DNS lookup. The hostname representation sent to DNS stays ASCII. Punycode is the encoding step within that larger process.

The DNS limit is 63 octets per label in its ASCII form. The prefix takes 4, leaving at most 63 − 4 = 59 ASCII characters of Punycode payload; this is not a limit on the number of Unicode characters you can type. The whole name has a DNS limit of 253 characters in dotted ASCII text without the trailing root dot. RFC 1035 specifies 255 octets on the wire, including label-length bytes and the root terminator; those account for the difference from dotted text.

This tool only lowercases labels that contain non-ASCII characters and applies Punycode per label. It leaves ASCII-only labels unchanged. It does not perform full IDNA processing: no Unicode normalization to NFC, no UTS 46 mapping, no validity or bidi checks, and no DNS length enforcement. Registries decide which eligible characters they allow. For registration, use the registrar and registry rules.

How emoji domains are encoded

Emoji are Unicode code points too; some displayed emoji are sequences of code points. Punycode can encode them, including code points beyond the Basic Multilingual Plane. For example, 💩.la becomes xn--ls8h.la in this converter.

Encoding a label does not establish that it is valid under IDNA or available to register. Whether a TLD or registry accepts emoji labels is a registry policy question, and many do not. Check its rules before choosing a name.

Look-alike domains and the xn-- form

Cyrillic а and Latin a are different code points, even when they look alike. The Cyrillic label in аррӏе.com encodes to xn--80ak6aa92e.com, whereas the Latin name apple.com stays apple.com. If a Latin-looking label becomes an xn-- label, it contains non-ASCII characters; this example uses non-Latin letters.

Read the name label by label: the prefix marks the encoded label, and the remainder is a Punycode payload you can paste into Decode. The prefix does not by itself indicate an attack or identify a script. Whether a browser displays Unicode or the ASCII form is a browser policy decision.

Live examples and exact edge-case outputs

Each result is computed from the same codec as the converter when this page renders. Quotes make empty strings visible. These examples show conversion behavior, not whether a domain can be registered.

German umlaut

Encode · typical

Input: "bücher.de"

Output: "xn--bcher-kva.de"

Look at the first label: its basic letters are copied first, then the umlaut is represented by the suffix. The ASCII suffix label stays unchanged.

Unicode and ASCII labels

Encode · typical

Input: "münich.com"

Output: "xn--mnich-kva.com"

Look for the prefix on only the label containing the umlaut. Dots separate labels; each label is processed independently.

Two Unicode labels

Encode · typical

Input: "例子.测试"

Output: "xn--fsqu00a.xn--0zwm56d"

Look for a separate prefix on each side of the dot. Both labels need encoding.

Emoji beyond the Basic Multilingual Plane

Encode · boundary

Input: "💩.la"

Output: "xn--ls8h.la"

Look at the encoded emoji label: the encoder reads the full Unicode code point, not just the first UTF-16 surrogate. Encoding does not establish registration eligibility.

Emoji between ASCII letters

Encode · boundary

Input: "a💩b.la"

Output: "xn--ab-8t72a.la"

Look for the two basic letters before the delimiter. The suffix records the emoji value and its position between them.

A label without basic characters

Encode · boundary

Input: "日本語.jp"

Output: "xn--wgv71a119e.jp"

Look after the prefix: there is no copied ASCII portion and therefore no delimiter between copied letters and encoded digits.

Uppercase Unicode label

Encode · boundary

Input: "MÜNICH.com"

Output: "xn--mnich-kva.com"

Look at the copied basic letters: a label containing non-ASCII characters is lowercased before encoding, so its original case is lost.

Already ASCII

Encode · boundary

Input: "EXAMPLE.com"

Output: "EXAMPLE.com"

Look at the uppercase letters: ASCII-only labels pass through unchanged, even their case. No prefix is added.

Decode a domain

Decode · typical

Input: "xn--bcher-kva.de"

Output: "bücher.de"

Look for the restored umlaut in its original position. The tool removes the prefix before decoding the payload.

Uppercase prefix and digits

Decode · boundary

Input: "XN--BCHER-KVA.DE"

Output: "BüCHER.DE"

Look at the mixed case in the result: prefix matching and encoded digits are case-insensitive, but copied ASCII letters retain their case. The decoded umlaut is not forced to uppercase.

Invalid encoded digit

Decode · failure

Input: "xn--%.com"

Output: "[Error: xn--%].com"

Look for the error marker around only the malformed label. The percent sign is not a Punycode digit; the other label still passes through.

Bare prefix is not rejected

Decode · failure

Input: "xn--"

Output: ""

Look at the quoted empty output: the bare prefix decodes to an empty string, without an error marker. This is not IDNA validation.

Cyrillic look-alike

Encode · typical

Input: "аррӏе.com"

Output: "xn--80ak6aa92e.com"

Look for the prefix despite the Latin-looking spelling. This label contains Cyrillic characters, not Latin letters. A prefix signals non-ASCII content, not necessarily a particular script or a malicious name.

Trailing root dot

Encode · boundary

Input: "bücher.de."

Output: "xn--bcher-kva.de."

Look at the final dot: splitting and rejoining the labels preserves the final empty label and the trailing dot.

Empty interior label is not rejected

Encode · failure

Input: "bücher..de"

Output: "xn--bcher-kva..de"

Look at the adjacent dots: the empty interior label passes through unchanged. A result here does not mean that the hostname is valid.

Punycode and IDNA history

RFC 3492 (2003), by Adam M. Costello, defines Punycode. IDNA uses it for ASCII-compatible domain labels. The original IDNA specification, RFC 3490 (2003), was replaced by the IDNA2008 document set, RFCs 5890–5894, which continues to use Punycode.

References: RFC 3492, “Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)”; RFC 5890, “Internationalized Domain Names for Applications (IDNA): Definitions and Document Framework”. DNS size limits: RFC 1035, section 2.3.4.

Frequently Asked Questions

What is Punycode?

Punycode is the reversible Unicode-to-ASCII encoding defined by RFC 3492. IDNA uses it to represent non-ASCII domain labels in ASCII form.

What does xn-- mean?

It is the IDNA ASCII-compatible encoding prefix. Read the part after it as a Punycode payload: xn--bcher-kva.de decodes here to bücher.de. The prefix alone does not prove that a label is valid.

How do I convert a domain to Punycode?

Choose Encode and enter a domain, or one domain per line. For example, bücher.de becomes xn--bcher-kva.de. This tool lowercases labels containing non-ASCII characters before encoding; ASCII-only labels pass through unchanged.

How do I decode xn--?

Choose Decode and paste the domain. The tool recognizes the prefix without regard to case, removes it from each matching label, and decodes the payload. For example, xn--bcher-kva.de becomes bücher.de.

Is Punycode encryption or a cipher?

No. It is an encoding with no secret key. Anyone can reverse it; it does not provide confidentiality.

How are emoji domains encoded?

Punycode handles the full Unicode code points: 💩.la becomes xn--ls8h.la. Encoding does not establish that a name is allowed. Registry policies decide which labels can be registered, and many do not accept emoji.

Why does bücher become bcher-kva?

The basic letters bcher are copied first, followed by a delimiter. The suffix kva records the value and position of ü so the decoder can insert it back into the word.

Can all Unicode characters be used in a domain name?

No. IDNA rules and registrar or registry policies restrict eligible names. This tool performs per-label lowercase and Punycode encoding only; it does not perform NFC normalization, UTS 46 mapping, validity or bidi checks, or enforce DNS length limits. Check the registrar and registry rules before registration.

Is the conversion done in my browser?

Yes. The interactive converter processes your input locally in your browser. Tutorial results are computed from the same codec when the page is rendered.

Features

Privacy Focused

All processing happens in your browser. No data is sent to servers.

Free Forever

No registration, no limits, completely free to use.