Free Online Tool

Punycode Encoder & Decoder

Convert international domain names (IDN) to ASCII-compatible Punycode format instantly. Encode & decode Unicode domains with 100% accuracy.

0 characters
Try Examples:
Output will appear here...
Advertisement Space

How Punycode Encoding Works

Understand the step-by-step process of converting Unicode domains to ASCII-compatible format

Step 1

Input Unicode Text

Enter any international domain name with Unicode characters like Chinese, Arabic, Hindi, Cyrillic, or accented Latin letters.

Punycode input step illustration
Step 2

Algorithm Processing

The Punycode algorithm (RFC 3492) separates ASCII characters, then encodes non-ASCII characters using variable-length integer encoding.

Punycode algorithm processing illustration
Step 3

Get ASCII Output

Receive the ASCII-compatible encoded domain prefixed with "xn--" ready for DNS resolution and browser compatibility.

Punycode output result illustration

Punycode Conversion Example

Unicode Input
münchen.de
International domain
Punycode Output
xn--mnchen-3ya.de
ASCII-compatible

The ASCII part "m" and "chen" stays unchanged. The "ü" character gets encoded as "-3ya" using the Punycode algorithm. The "xn--" prefix signals this is an ACE-encoded label.

Advertisement Space

Complete Guide to Punycode Encoding

What is Punycode?

Punycode is a specialized encoding syntax defined in RFC 3492 that converts Unicode strings into a limited ASCII character subset. It was specifically designed to enable internationalized domain names (IDNs) on the internet, where the Domain Name System (DNS) traditionally only supports ASCII characters (a-z, 0-9, and hyphens). Without Punycode, domain names containing non-English characters such as Chinese (中文), Arabic (العربية), Hindi (हिन्दी), Cyrillic (россия), or accented Latin characters (café, münchen) would be impossible to register or resolve through standard DNS infrastructure.

How Does Punycode Encoding Work?

The Punycode encoding algorithm follows a systematic approach to compress Unicode data into ASCII. First, it identifies and separates all basic ASCII characters (code points below 128) from non-ASCII characters. The basic characters are placed at the beginning of the output string in their original order. If there are any non-ASCII characters, a hyphen delimiter (-) is appended after the basic characters. Then, the non-ASCII characters are encoded using a variable-length integer representation based on their code point values relative to previously encoded characters. The algorithm uses an adaptive bias mechanism that adjusts the encoding thresholds dynamically based on how many characters have been processed, making it efficient for different types of input strings.

Understanding the xn-- Prefix

When Punycode is used for domain names, each encoded label is prefixed with "xn--" (ASCII Compatible Encoding prefix). This prefix is defined by the Internationalized Domain Names in Applications (IDNA) standard and serves as a signal to DNS software that the label contains Punycode-encoded content. For example, the domain "bücher.de" becomes "xn--bcher-kva.de" in its ASCII form. The "xn--" prefix ensures backward compatibility with existing DNS infrastructure while allowing international characters in domain names. All modern web browsers automatically convert xn-- prefixed domains back to their Unicode form for display in the address bar.

Why is Punycode Important for Web Developers?

Punycode encoding is essential for several critical use cases in web development and cybersecurity. Domain registrars use Punycode to process international domain name registrations. DNS providers need Punycode to properly configure zone files for IDN domains. SSL/TLS certificate authorities encode international domains in Punycode format within certificates. Security professionals use Punycode converters to detect homograph attacks, where malicious actors register domains that look identical to legitimate domains using visually similar Unicode characters. Email validation systems must handle Punycode-encoded email addresses in international TLDs. Understanding Punycode is also crucial for SEO professionals working with international websites, as search engines index both the Unicode and Punycode versions of domain names.

Common Punycode Conversion Examples

Unicode Domain Punycode (ASCII) Language
münchen.dexn--mnchen-3ya.deGerman
例え.jpxn--fsq092o.jpJapanese
中国.cnxn--fiqs8s.cnChinese
россия.рфxn--h1alffa9f.xn--p1aiRussian
café.comxn--caf-dma.comFrench
भारत.inxn--h2brj9c.inHindi

Security Considerations: Punycode Phishing

One of the most important security aspects of Punycode is its role in homograph phishing attacks. Because some Unicode characters look nearly identical to ASCII characters (for example, the Cyrillic "а" looks like the Latin "a", and the Greek "ο" looks like the Latin "o"), attackers can register domains that visually mimic legitimate websites. When browsers display the Unicode version, users may not notice they are on a fake site. Modern browsers have implemented protections against these attacks by displaying Punycode in the address bar when a domain mixes scripts from different languages. Using a Punycode decoder tool helps security researchers and cautious users verify the actual characters in a domain name before interacting with a website.

Features of Our Punycode Encoder Tool

ToolGalaxy's Punycode Encoder offers a comprehensive, browser-based solution with no server-side processing. Your data never leaves your device, ensuring complete privacy. The tool supports both individual text label encoding and full domain name conversion with automatic per-label processing. Real-time conversion provides instant feedback as you type. The built-in decoder reverses the process, converting xn-- prefixed domains back to readable Unicode. Example buttons for major languages let you quickly test the tool. The responsive design works perfectly on desktop, tablet, and mobile devices. Copy-to-clipboard functionality makes it easy to transfer results to your DNS configuration, code, or documentation.

Advertisement Space

Frequently Asked Questions

Everything you need to know about Punycode encoding

Advertisement Space