# Punycode converter

Convert internationalised domain names to their ASCII "xn--" form and back.

- Endpoint: `POST https://setget.net/v1/tools/punycode` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `punycode`
- Page: https://setget.net/tools/punycode

## Inputs

- `text` (required, string): The domain name to convert.
- `action` (optional, string, one of `encode`, `decode`, default `"encode"`): Encode a Unicode domain to ASCII, or decode an "xn--" domain to Unicode.

## Example 1

```json
{"input":{"text":"münchen.de"}}
```

Result:

```json
{"text":"xn--mnchen-3ya.de","changed":true}
```

## Example 2

```json
{"input":{"text":"xn--mnchen-3ya.de","action":"decode"}}
```

Result:

```json
{"text":"münchen.de","changed":true}
```

## Example 3: Every label is converted on its own

```json
{"input":{"text":"例え.テスト"}}
```

Result:

```json
{"text":"xn--r8jz45g.xn--zckzah","changed":true}
```

**What is the "xn--" prefix?** It marks a domain label that holds non-ASCII characters in encoded form. DNS itself only carries ASCII, so browsers convert names both ways.

**Why did "ß" become "ss"?** Encoding follows the older IDNA 2003 rules, which fold a few characters: the German sharp s becomes "ss" and capitals become lower case. Registries using IDNA 2008 keep "ß" as its own character.

**Why can look-alike domains be dangerous?** Letters from different scripts can look identical, for example Latin "a" and Cyrillic "а". Decoding an "xn--" name here shows what it really contains.
