# Dns rdata decode

`dns-rdata-decode` · version 1.0.0 · Communications · free, no key needed

Decode DNS RDATA hex for A, AAAA, NS, CNAME, PTR, MX, TXT, SOA, SRV, or unknown.

**Use when you need to: decode dns rdata hex · dns wire rdata to record fields · parse uncompressed dns rdata octets.**

## Decide before calling

Read the [versioned contract](/v1/tools/dns-rdata-decode/versions/1.0.0) and the supported scope below. Reuse `dns-rdata-decode@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `dns-rdata-decode@1.0.0` for decode dns rdata hex. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- decode dns rdata hex
- dns wire rdata to record fields
- parse uncompressed dns rdata octets
- read dns a aaaa mx txt soa srv wire
- decode a dns resource record rdata
- turn dns rdata octets into fields
- פענוח נתוני רשומת דיאן אס

## Not supported

- query DNS or resolve a hostname
- follow a compression pointer into a DNS message
- verify DNSSEC signatures or check TTLs
- parse a DNS message header or question section

## Behavior

- Input is an explicit rr_type_code and rr_class_code plus lowercase even-length rdata_hex. The nine structured types are parsed; every other code, including codes absent from the pinned excerpt, returns the same hex with wire_known false.
- A name is counted from its own first octet. The wire form must be uncompressed and at most 255 octets (RFC 1035 sections 2.3.4 and 3.1). 256 or 257 octets is invalid_input, including a name that begins after the MX preference or the SRV priority, weight and port.
- A compression pointer (top bits 11) or a reserved label type (top bits 01 or 10) is invalid_input. This codec has no message to resolve pointers against.
- A is 4 octets emitted as canonical dotted decimal. AAAA is 16 octets emitted as RFC 5952 lowercase text, with the leftmost longest run of at least two zero groups compressed, and without a dotted IPv4 tail.
- TXT is one or more character-strings. Printable ASCII other than backslash is emitted as text; every other octet is \DDD, and backslash is \\. A known type that does not consume the hex exactly is invalid_input.
- When the code is in the pinned excerpt, rr_type or rr_class is that canonical mnemonic (* for 255). Otherwise the name is null. data_version is iana-dns-parameters-2026-10-21.
- No DNS query is sent. More than 262144 UTF-8 bytes of JSON input, or more than 65535 RDATA octets, is limit_exceeded before parsing.
- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.

## Input

- `rr_type_code` (integer, required): min 0; max 65535
- `rr_class_code` (integer, required): min 0; max 65535
- `rdata_hex` (string, required): min length 0; max length 131070; pattern `^([0-9a-f]{2})*$`

## Output

- `data_version` (constant "iana-dns-parameters-2026-10-21", required)
- `rr_type` (string or null, required): min length 1; max length 12
- `rr_type_code` (integer, required): min 0; max 65535
- `rr_class` (string or null, required): min length 1; max length 4
- `rr_class_code` (integer, required): min 0; max 65535
- `wire_known` (boolean, required)
- `rdata_length` (integer, required): min 0; max 65535
- `ipv4` (string, optional): min length 7; max length 15
- `ipv6` (string, optional): min length 2; max length 39
- `domain_name` (string, optional): min length 1; max length 2048
- `preference` (integer, optional): min 0; max 65535
- `exchange` (string, optional): min length 1; max length 2048
- `txt_chunks` (array of string, optional): min items 1; max items 4096; each min length 0; each max length 2048
- `mname` (string, optional): min length 1; max length 2048
- `rname` (string, optional): min length 1; max length 2048
- `serial` (integer, optional): min 0; max 4294967295
- `refresh` (integer, optional): min 0; max 4294967295
- `retry` (integer, optional): min 0; max 4294967295
- `expire` (integer, optional): min 0; max 4294967295
- `minimum` (integer, optional): min 0; max 4294967295
- `priority` (integer, optional): min 0; max 65535
- `weight` (integer, optional): min 0; max 65535
- `port` (integer, optional): min 0; max 65535
- `target` (string, optional): min length 1; max length 2048
- `rdata_hex` (string, optional): min length 0; max length 131070; pattern `^([0-9a-f]{2})*$`

## Limits

- max input bytes: 262144
- max rdata bytes: 65535

## Example

Request input:

```json
{
  "rr_type_code": 1,
  "rr_class_code": 1,
  "rdata_hex": "c0000201"
}
```

Response:

```json
{
  "result": {
    "data_version": "iana-dns-parameters-2026-10-21",
    "rr_type": "A",
    "rr_type_code": 1,
    "rr_class": "IN",
    "rr_class_code": 1,
    "wire_known": true,
    "rdata_length": 4,
    "ipv4": "192.0.2.1"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "dns-rdata-decode",
  "version": "1.0.0",
  "input": {
    "rr_type_code": 1,
    "rr_class_code": 1,
    "rdata_hex": "c0000201"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/dns-rdata-decode/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"rr_type_code":1,"rr_class_code":1,"rdata_hex":"c0000201"}'
```

The machine-readable contract is at [/v1/tools/dns-rdata-decode/versions/1.0.0](/v1/tools/dns-rdata-decode/versions/1.0.0).

### CLI

```sh
node cli.mjs run dns-rdata-decode 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Dns rdata encode](/tools/dns-rdata-encode): Encode DNS RDATA for A, AAAA, NS, CNAME, PTR, MX, TXT, SOA, SRV, or unknown hex.
- [Dns message parse](/tools/dns-message-parse): Parse a DNS message hex string into the RFC 1035 header, questions, and resource records.
- [Dns message encode](/tools/dns-message-encode): Encode a structured DNS message to canonical uncompressed RFC 1035 wire hex.
- [Dns type code lookup](/tools/dns-type-code-lookup): Look up a pinned DNS RR type mnemonic or its numeric code.
- [Email address list parse](/tools/email-address-list-parse): Parse an RFC 5322 address-list into ordered mailboxes, groups, and a canonical form.
- [Dns header flags explain](/tools/dns-header-flags-explain): Explain an RFC 1035 DNS header flags word, with reserved Z as an integer 0 through 7.
