Encoding

Punycode encode/decode

Encode internationalized domain names (IDN) with unicode characters into ASCII-compatible Punycode (xn--) and back.

The DNS system historically only supports ASCII characters, so domain names with Cyrillic, CJK, or other non-ASCII characters (IDN) are encoded as Punycode — an ASCII-compatible form prefixed with xn--. This tool encodes and decodes such domains.

How to use it

Common uses

Things to keep in mind

Visually similar characters from different scripts (like Cyrillic "а" and Latin "a") can form a domain that looks identical to a known brand — this is the basis of homograph phishing.

Not every browser shows decoded Unicode the same way: when a domain label mixes scripts, browsers often deliberately show the raw xn-- form as a warning sign.

Article about this tool: Punycode: how internationalized domains work in DNS

Frequently asked questions

What is Punycode used for?

Punycode encodes internationalized domain names containing non-ASCII characters (like münchen.de) into an ASCII-compatible form prefixed with xn--, since the DNS system only supports ASCII labels.

Why should I be careful with Punycode domains?

Punycode enables homograph attacks, where lookalike characters from other alphabets are used to register domains that look identical to a trusted one. If a domain shows an xn-- prefix, decode it here to see what it actually spells out.

Does this only work on full domain names?

You can encode or decode a single label or a full dotted domain — each label between dots is converted independently, with the xn-- prefix only added to labels that actually contain non-ASCII characters.

How can I tell that a link uses Punycode?

An encoded domain always has an xn-- prefix before each label containing non-ASCII characters. If you see a domain starting with xn-- in an address bar or email, that's a sign of IDN — worth checking what text is hiding behind the encoding.

Do all browsers show Cyrillic in the address bar the same way?

No. Some browsers only show decoded Unicode if every character in the domain belongs to a single alphabet, and when scripts are mixed (a sign of a homograph attack) they deliberately show the raw xn-- form instead of the original characters.

Articles: Encoding

Base64: why encoding is needed and how it works

How Base64 turns binary data into ASCII text and where that is actually needed.

Base32: how it differs from Base64 and when it is more convenient

The case-insensitive Base32 alphabet and scenarios where it beats Base64.

URL Encode/Decode: percent-encoding in links

How special characters in URLs and query parameters turn into %XX sequences.

HTML Entities: how to safely output special characters on a page

Why the characters < > & need escaping and how that prevents broken markup.

JWT: token structure and what "decoding" a JWT actually means

The header, payload, and signature of a JWT, and why decoding is not the same as verifying the signature.

Unicode Escape: what \uXXXX sequences mean

Where \u0041-style sequences in JSON and JS strings come from and what they mean.

ROT13 and the Caesar cipher: simple character substitution

Why shifting by 13 letters makes ROT13 self-inverse, and why anyone still uses it today.

Morse code: how text becomes dots and dashes

The principle behind encoding letters as dots and dashes, and where Morse code is still used today.

Data URI: when to embed images directly in code

How a data: URI embeds a file’s contents directly in HTML or CSS, and when that is worth it.

Gzip + Base64: compressing data for text-based transfer

Why compressed binary data also gets Base64-encoded before going into a text field.

XML Entities: escaping characters in XML documents

The five required XML entities without which a document breaks during parsing.