Punycode IDN Converter Calculator
Type bücher.example and it becomes xn--bcher-kva.example. Its longest label is 13 characters, inside the 63-character DNS limit.
Last reviewed
Converted name, with the steps that built it
Converted name
xn--bcher-kva.example
Labels converted
1
Longest label in the result
13 characters
Label length against 63
The longest ASCII label is 13 characters, within the 63-character label limit of DNS names.
Label shown in the step table
label 1, "bücher"; the ASCII characters "bcher" are copied first with a hyphen after them
Standard applied
RFC 3492 sections 6.1 to 6.3 with the Punycode parameters of section 5 (base 36, tmin 1, tmax 26, skew 38, damp 700, initial bias 72, initial n 128); the xn-- prefix is the IDNA convention.
bücher.example encodes as xn--bcher-kva.example: 1 label converted, the longest label 13 characters, inside the 63-character label limit DNS allows.
The step table traces the label bücher: 1 insertion starting with ü (U+00FC) at delta 745, written as the digit string kva.
Across those steps the bias moves from 72 to 0, and the label after the prefix runs 9 characters.
Domain name and direction
- copied ASCII bcher + hyphen
- delta = (0x00FC − 128) × (placed + 1) + passed = 745
- base 36 with bias 72: k(10) v(21) a(0) → kva
- bias after last step = 0
- converted name = xn--bcher-kva.example
Steps of the Punycode algorithm
| Step | Code point | Character | Delta | Digits | Bias after |
|---|---|---|---|---|---|
| 1 | U+00FC | ü | 745 | kva | 0 |
One insertion: ü (U+00FC) at delta 745, written kva, bias 72 to 0. Encoding runs the same arithmetic forwards.
How Punycode turns Unicode letters into xn--
Punycode is the encoding that lets a domain name hold letters outside ASCII. RFC 3492 defines it: "Punycode is a simple and efficient transfer encoding syntax designed for use with Internationalized Domain Names in Applications (IDNA)." The same RFC promises the two directions this page offers: "It uniquely and reversibly transforms a Unicode string into an ASCII string." The plain ASCII letters of a label are copied to the front, and each remaining letter is described by a number. For bücher the letters b, c, h, e, r are copied, then a hyphen, then the digits that place the ü.
Each non-ASCII letter is placed by a delta, a count of how far the insertion point has moved. Take münchen. Its ü sits at code point 252 (U+00FC), 124 places above the 128 where counting starts. Seven letters can hold an insertion at that moment, so the delta is 124 x 7 = 868. One letter (the m) stands before the ü, giving 869. Deltas are written in base 36. The letters a to z stand for 0 to 25, and the digits 0 to 9 for 26 to 35. So delta 869 becomes 3 (29), y (24) and a (0). The label is mnchen-3ya. To see another number format that grows only as large as it must, open the QUIC variable-length integer calculator.
The number of digits a delta needs depends on a bias that adapts after every insertion. That is what keeps labels short when all the letters come from one script. The Greek word for example, παράδειγμα, has 10 letters and no ASCII to copy. Yet its whole label is only 14 characters after xn--, because after the first delta (812) no later delta needs more than three digits. When a label mixes far-apart letters the deltas grow. Adding the emoji ☕ (U+2615, delta 47580) to café stretches café's own delta of 423 into a five-digit tail, and the label runs 16 characters.
The xn-- in front is not part of RFC 3492. RFC 5891, the protocol that registers internationalized names, says in section 4.4: "The A-label is the encoding of the U-label according to the Punycode algorithm [RFC3492] with the ACE prefix "xn--" added at the beginning of the string." RFC 5890 limits the Punycode part of an A-label to 59 ASCII characters after the 4-character xn-- prefix, which keeps the label within the 63-character DNS limit. Reading a name back works the same way: RFC 5891 treats the prefix case-insensitively, and a lookup application may convert XN--BCHER-KVA back; this page does.
From the address bar to the DNS zone
The DNS zone holds the A-label. RFC 5891 describes registration in one line: "The label is registered in the DNS by inserting the A-label into a zone." The record you or your registrar sees holds the xn-- form: bücher.example lives in the zone as xn--bcher-kva.example. So paste what this page shows under "Converted name" wherever a tool asks for the domain.
What a registry accepts is narrower than what Punycode can write. RFC 5891 says the string is "checked and processed as appropriate to local registry restrictions", and those restrictions "may result in the rejection of some labels". ICANN’s page explains the purpose: "Internationalized Domain Names (IDNs) enable people around the world to use domain names in local languages and scripts." Registries offering IDNs rely on IDN tables, also called "Label Generation Rules", to say which letters are allowed. A name that converts cleanly here can still be rejected there. For the arithmetic a zone’s serial numbers follow between updates, see the DNS serial number calculator, and to check a record’s fingerprints, read the DNSSEC key tag and DS digest calculator.
Video walkthrough
A 2½-minute walkthrough of the label behind an international domain name: the deltas that place each letter, the digit strings they are written in, and the length limit the domain system puts on them.
Read the transcript
Why does my name show xn--?
0:00 Type bücher.example into the form and the name comes back as xn--bcher-kva.example.
0:08 Both spellings are one name:
0:11 your plain letters stay in the label the domain name system stores.
0:15 Letters and digits stand for the rest.
0:18 Run that stored name back the other way and bücher.example returns.
0:23 The standard for international names says a lookup application may attempt to convert the stored form back to its Unicode form.
How is an xn-- label built?
0:32 A stored label is built move by move.
0:35 Any plain letters are copied to the front, with a hyphen after them.
0:40 Each remaining letter is described by a number.
0:43 Here is the label we follow: bücher.
0:46 The worked sheet copies the plain letters b, c, h, e and r, with a hyphen after them.
0:52 The ü is placed by a delta of 745, written as the digits kva.
What does each letter cost?
0:59 Each letter outside plain ASCII is placed by one number: its delta.
1:04 The same letter twice, büchü, shows what a repeat costs.
1:09 In büchü the first ü costs a delta of 497.
1:14 The same letter again costs 2, written as the single digit c.
1:19 One more setting helps the numbers stay short: the bias adapts after each insertion.
How long can a label be?
1:25 All those digits run against one limit: the domain name system holds each label to 63 characters.
1:33 The xn-- prefix takes 4 of those characters, leaving 59 for the encoding.
1:38 The label we follow needs only 9 of them, well inside the limit.
What happens where the name is stored?
1:43 The zone holds what the standards call the A-label: the stored form in ASCII.
1:49 Case is kept as typed: the label in upper case decodes to BüCHER.example.
1:55 What converts here can still be refused there: registry restrictions may result in the rejection of some labels.
How do I check my own name?
2:03 Type your own name, like büchü.
2:05 When you pause, the result cards update.
2:08 The results show the converted name, the labels converted, and the longest label.
2:14 The name comes back as xn--bch-hoac, with the steps that built it: each delta and digit written out.
2:22 The Delta column holds one number per row: the cost of placing that letter.
2:27 The stored form and your typed name are one name.
2:30 Each non-ASCII letter is placed by its delta, and the zone holds the A-label.
2:35 Type your own name at fastcalc.us.
The Punycode formulas (bias, thresholds, deltas)
delta = delta + (m - n) x (h + 1), then +1 per earlier code point digit = t + (q - t) mod (36 - t); q = (q - t) div (36 - t) t = 1 if k <= bias, 26 if k >= bias + 26, else k - bias adapt: delta div 700 (first) or div 2; delta + delta div n; while delta > 455: delta div 35, k + 36; answer k + 36 delta div (delta + 38)
Worked examples: bücher, café and a Japanese label
bücher: the five ASCII letters b, c, h, e, r are copied with a hyphen (bcher-). The only other letter is ü (U+00FC, 252). The delta is (252 − 128) × 6 + 1 = 745, written kva, and the bias falls from 72 to 0. The label is xn--bcher-kva, 13 characters.
café: three letters copy (caf-), and é (U+00E9, 233) gives delta (233 − 128) × 4 + 3 = 423, written dma, so café becomes xn--caf-dma, 11 characters. Adding ☕ after the é pushes the second delta to 47580 and five digits (4968b), and the label runs to xn--caf-dma4968b, 16 characters.
日本語.jp: no ASCII copies at all, so there is no hyphen. Three letters insert with deltas 25957 (wgv), 654 (71a) and 27222 (119e), and the label xn--wgv71a119e is 14 characters. The RFC's Arabic sample needs seventeen insertions for its seventeen letters. It still fits in 26 characters, the everyday size of a working internationalized label.
Labels that trip up a reader
Hyphens have two jobs, and only one of them is a separator. RFC 3492 warns: "The encoded string can begin with a hyphen-minus, but IDNA prepends a prefix." So an xn-- label can hold a copied hyphen right after the prefix: the RFC's own sample xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n decodes to 安室奈美恵-with-SUPER-MONKEYS. The last hyphen in the payload is always the separator. Every hyphen before it was copied.
Case is kept, not normalised. An upper-case XN-- prefix is read because the prefix check ignores case, and the payload's digits may arrive in either case too. The letters before the hyphen keep the case they were encoded with: XN--BCHER-KVA.example decodes to BüCHER.example. Emoji encode as easily as letters, because Punycode only counts code points. The coffee emoji ☕ becomes xn--53h (delta 9621, three digits). Encoding one is not registering one, though, and ICANN publishes a whole document on why "Emojis in Domain Names" are "a security risk when used in domain names".
Repetition is the cheapest thing Punycode writes. The first 日 costs delta 25957, the digits wgv, and each further 日 is one more position to count, a delta of 0. Ten copies encode to xn--wgvaaaaaaaaa, and twenty copies still run only 26 characters, far inside the 63-character limit. A dot-like character is not a separator here: the ideographic full stop (。) that some input methods offer is encoded as an ordinary letter, because this page splits labels only at the ASCII dot.
What this page does and does not apply
- This is the Bootstring algorithm of RFC 3492 for Punycode and nothing more. A real internationalized domain name also needs the IDNA standards (RFC 5890 to 5893 or the older RFC 3490). Those standards map upper case and compatibility characters, and put Unicode into normal form. They say which characters a label may use, handle right-to-left scripts, and check that a label decodes back to what was encoded. This page applies none of them, so it will happily encode a character that a registry would refuse. The registry or the browser decides what is accepted.
- Labels are split at the ASCII dot only. The ideographic full stop and other dot-like characters that some IDNA mappings treat as separators are encoded as ordinary characters. Case is kept as typed. An upper-case ASCII letter stays upper case in the literal part, and the digits are always written in lower case. RFC 3492 allows either case and has an optional mixed-case annotation that this page does not use.
- A label with only ASCII characters is left as it is in the Unicode-to-ASCII direction. IDNA never encodes pure ASCII labels. In the other direction the xn-- prefix is read in either case, and a label without it is left as it is. The digit values are limited to 32 bits, as in the RFC's sample code; the page takes up to 255 characters.
- The 63-character check follows the length limit RFC 3492 section 6.4 attributes to DNS labels. The 253-character limit on a whole name is not checked. Nothing you type is stored or sent.
Using an xn-- name in the real world
Check the length before you register. The xn-- form must fit the 63-character DNS label limit, and this page checks it for you under "Label length against 63". bücher.example becomes a 13-character label. A long Japanese phrase can go over the limit.
Look the name up in its stored form. Registries keep the ASCII form. A whois or DNS query for the name above should use xn--bcher-kva.example (13 characters), not the letters. If you maintain the domain's records, the reverse DNS PTR name calculator is the same idea from the IP side. It stores one string that is not what a person types.
Decode a link before you trust it. An xn-- label in an address bar or an email link can hide look-alike letters. Paste it here and read what comes back. The coffee emoji ☕ alone is xn--53h. That shows how little of an xn-- label needs to change to carry a different character.
Read the bias column to see the algorithm settle. bücher's single delta of 745 ends with bias 0. A word with two umlauts shows the saving. In büchü the first ü costs a delta of 497 and the second only 2, written as the single digit c.
Punycode and IDN questions
Why does my domain show xn-- in the browser?
Both spellings name the same site: xn--bcher-kva decodes to bücher, 6 letters against 13 ASCII characters. RFC 5891 says a lookup application "MAY attempt to convert" an A-label to its Unicode form, so an IDN-aware address bar can show the letters while a zone file or a whois record shows the ASCII form.
Is a name that converts here a valid internationalized domain name?
Not necessarily. Converting is arithmetic; validity is decided by the IDNA standards and by the registry of the top-level domain, which limit the characters, scripts and combinations a name may use. RFC 5891 says registry restrictions "may result in the rejection of some labels", so a name whose xn-- form is 13 clean characters can still be refused.
How long can an internationalized label be?
The ASCII form must fit in 63 characters: 4 for xn-- plus at most 59 for the encoding. Three Japanese letters take 14 characters, but repetition is cheap, since each extra copy of the same letter adds one digit, and 14 copies of 日 still run only 20 characters.
Can I use emoji in a domain name?
Punycode encodes them, because it counts code points, not letters: ☕ becomes xn--53h with delta 9621. ICANN publishes a document on why emoji in domain names are a security risk, so treat an emoji label as a curiosity, not a registration.
Does an upper-case XN-- label still decode?
Yes. RFC 5891 reads the prefix case-insensitively, and the digits may be upper case too, so XN--BCHER-KVA.example decodes to BüCHER.example. The letters copied before the hyphen keep the case they were encoded with, which is why the B stays upper case.
What is the difference between Punycode and IDNA?
Punycode is only the packing: RFC 3492 turns a label into letters, digits and hyphens, with base 36 for its numbers and a starting bias of 72. IDNA is the framework around it: the prefix, the character tables, and the mapping and normal-form steps. This page does the packing exactly and applies none of them.
Why is there a hyphen in the middle of every xn-- label?
It separates the copied ASCII letters from the digits. In bcher-kva the five letters before the hyphen were copied from bücher, and everything after it places the non-ASCII letters. A label with no ASCII to copy, like 日本語, has no hyphen at all: xn--wgv71a119e starts with a digit.
What do the delta, digits and bias columns mean?
Each row is one inserted letter. The delta says how far the insertion point moved (745 for the ü in bücher). The digits are that number in base 36 (kva). The bias is the adaptive setting that keeps later numbers short. It starts at 72 and falls to 0 after bücher's single insertion.
Sources
- IETF, RFC 3492, Punycode: A Bootstring encoding of Unicode for IDNA (A. Costello, March 2003) (version Mar 2003)
- IETF, RFC 5891, IDNA: Protocol (J. Klensin, August 2010) (version Aug 2010)
- IETF, RFC 5890, IDNA: Definition, Mechanisms, and Framework (J. Klensin, August 2010) (version Aug 2010)
- ICANN, Internationalized Domain Names (current version)
More in Computing & Networking Calculators and Math & Geometry Calculators.