My store uses an Arabic domain name. Why does the link parts table show the host as letters starting with xn--?

Because domain names are converted to a Latin form called Punycode, where each label starts with xn--, while the path after the domain is encoded a different way, with % codes. The parts table shows the host as the browser understands it and the path decoded back to Arabic. The tool itself does not convert domains when encoding.

Published · 3 min read

What the tool showed

We pasted the link to a perfumes page on a store with an Arabic domain, متجر.السعودية (store dot Saudi):

https://متجر.السعودية/عطور

The 'URL parts' table showed:

  • Host: xn--pgbep1f.xn--mgberp4a5d4ar. The first label is متجر and the second السعودية, each in Punycode.
  • Path: /عطور, decoded.
  • Path, encoded: /%D8%B9%D8%B7%D9%88%D8%B1, the form that actually travels.

So one link uses two methods: the domain in xn-- form, the path in % codes.

Why two methods?

The domain name system, which turns a site's name into a server address, was designed for Latin letters, digits and the hyphen only. When Arabic and other names were added, a way was found to write them in that limited alphabet without changing the system: Punycode, with xn-- at the front so software knows the label was converted. The path, on the other hand, is read by the site's own server, and its rule is % codes for UTF-8 bytes.

What you see in the browser follows from that: the address bar shows the name in Arabic, but the request goes out in xn-- form.

A warning: do not encode an Arabic domain with the tool

We encoded the same link in 'Full URL' mode, and the domain was encoded with % codes like the path: https://%D9%85%D8%AA%D8%AC%D8%B1... That is not the right form for a domain, which is never written with % codes. The tool says so in its limits: it does not convert domain names to Punycode when encoding. If you need an encoded link for a store with an Arabic domain, encode only the path, and write the domain as it is or in the xn-- form the parts table shows.

Steps

  1. Open the URL encoder/decoder and paste your store link with 'Decode' selected.
  2. Copy the xn-- form from the 'Host' field if a system or settings panel will not accept Arabic letters.
  3. To encode a page path, paste the path alone, such as /عطور, with 'Encode' and 'Full URL'.
  4. Assemble the link: the domain, then the encoded path.

Where you need the xn-- form

  • In some domain, email or certificate settings panels that only accept Latin characters.
  • When comparing visit logs or technical reports, which often write the domain in xn-- form.
  • Not in ads or customer messages: the browser shows the Arabic name.

To see how your page link might look in search results, try it in the Search snippet preview.

Common questions

Are the xn-- form and the Arabic name two different sites?

No, they are the same name written two ways. The browser converts one into the other.

Does my domain's xn-- form ever change?

No, the conversion is fixed: the same name always gives the same form.

Why does a 'Path, encoded' row appear?

It appears when the encoded path differs from the decoded one, meaning it contains Arabic letters or spaces.