Encoding Utilities

Punycode Encode

Converts Unicode text to Punycode format, essential for internationalized domain names (IDNs). Use via MCP in Cursor or Windsurf for domain validation, or call GET /v1/encode/punycode/encode directly. Input "münchen.de" returns "xn--mnchen-3ya.de" — the ASCII-compatible encoding that DNS systems require for non-Latin domains.

API Endpoint

GET /v1/encode/punycode/encode

Code Examples

curl "https://tinyfn.io/v1/encode/punycode/encode" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/encode/punycode/encode', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/encode/punycode/encode',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's encoding tools:

{
  "mcpServers": {
    "tinyfn-encoding": {
      "url": "https://tinyfn.io/mcp/encoding",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What is Punycode and why do I need it for international domains?

Punycode converts Unicode characters to ASCII-compatible format that DNS systems can handle. International domain names like 中国.com become xn--fiqs8s.com in Punycode.

How do I encode Unicode domain names using MCP in my AI coding assistant?

Call the punycode encode tool with your Unicode domain. The MCP tool returns the xn-- prefixed ASCII version that browsers and DNS servers recognize.

What happens if I pass already ASCII text to Punycode encoding?

Pure ASCII text passes through unchanged since it's already DNS-compatible. Only non-ASCII Unicode characters get the xn-- encoding treatment.

Can I encode entire email addresses or just domain parts?

Punycode only applies to domain parts. For email addresses like user@café.com, only encode the domain portion (café.com → xn--caf-dma.com).

Does Punycode encoding preserve the original Unicode meaning?

Yes, Punycode is reversible. The encoded xn-- format contains all information needed to decode back to the original Unicode characters perfectly.

Try Punycode Encode Now

Get your free API key and start using Punycode Encode in seconds.

Get Free API Key