# Dns header flags explain

`dns-header-flags-explain` · version 1.0.0 · Communications · free, no key needed

Explain an RFC 1035 DNS header flags word, with reserved Z as an integer 0 through 7.

**Use when you need to: explain dns header flags word · decode rfc 1035 qr opcode and rcode · split a dns flags hex word.**

## Decide before calling

Read the [versioned contract](/v1/tools/dns-header-flags-explain/versions/1.0.0) and the supported scope below. Reuse `dns-header-flags-explain@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-header-flags-explain@1.0.0` for explain dns header flags word. 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

- explain dns header flags word
- decode rfc 1035 qr opcode and rcode
- split a dns flags hex word
- what does this dns header flag mean
- read the dns header z field
- interpret query and response flag bits
- הסבר דגלי הכותרת של הודעת די אן אס

## Not supported

- split header z into ad and cd bits
- explain the edns do bit or opt ttl
- parse a whole dns message
- decide whether a response is authentic

## Behavior

- flags_hex is exactly four lowercase hex digits, the RFC 1035 Section 4.1.1 flags word. Diagram columns are numbered 0 through 15 from the left.
- QR is column 0, opcode is columns 1 through 4 as an integer 0..15, AA TC and RD are columns 5 through 7, RA is column 8, Z is columns 9 through 11 as an integer 0..7, and RCODE is columns 12 through 15 as an integer 0..15.
- Opcode names are only the RFC 1035 assignments: 0 query, 1 iquery, 2 status. Other opcodes are unassigned. RCODE names are 0 no_error, 1 format_error, 2 server_failure, 3 name_error, 4 not_implemented, 5 refused. Values 6 through 15 are unassigned. Later names such as NXDOMAIN, AD and CD are not used.
- The word 0070 sets only the three Z columns and returns z 7. A value outside four hex digits fails: longer input is limit_exceeded, any other shape is invalid_input.
- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.

## Input

- `flags_hex` (string, required): min length 4; max length 4; pattern `^[0-9a-f]{4}$`

## Output

- `flags` (integer, required): min 0; max 65535
- `flags_hex` (string, required): min length 4; max length 4; pattern `^[0-9a-f]{4}$`
- `qr` (boolean, required)
- `opcode` (integer, required): min 0; max 15
- `opcode_name` (one of "query", "iquery", "status", "unassigned", required)
- `aa` (boolean, required)
- `tc` (boolean, required)
- `rd` (boolean, required)
- `ra` (boolean, required)
- `z` (integer, required): min 0; max 7
- `rcode` (integer, required): min 0; max 15
- `rcode_name` (one of "no_error", "format_error", "server_failure", "name_error", "not_implemented", "refused", "unassigned", required)

## Limits

- max flags hex chars: 4

## Example

Request input:

```json
{
  "flags_hex": "0070"
}
```

Response:

```json
{
  "result": {
    "flags": 112,
    "flags_hex": "0070",
    "qr": false,
    "opcode": 0,
    "opcode_name": "query",
    "aa": false,
    "tc": false,
    "rd": false,
    "ra": false,
    "z": 7,
    "rcode": 0,
    "rcode_name": "no_error"
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "dns-header-flags-explain",
  "version": "1.0.0",
  "input": {
    "flags_hex": "0070"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/dns-header-flags-explain/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"flags_hex":"0070"}'
```

The machine-readable contract is at [/v1/tools/dns-header-flags-explain/versions/1.0.0](/v1/tools/dns-header-flags-explain/versions/1.0.0).

### CLI

```sh
node cli.mjs run dns-header-flags-explain 1.0.0 --input input.json --base-url https://computefirst.net
```

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

## Related tools

- [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.
- [Email address list parse](/tools/email-address-list-parse): Parse an RFC 5322 address-list into ordered mailboxes, groups, and a canonical form.
- [Dns rdata decode](/tools/dns-rdata-decode): Decode DNS RDATA hex for A, AAAA, NS, CNAME, PTR, MX, TXT, SOA, SRV, or unknown.
- [Dns type code lookup](/tools/dns-type-code-lookup): Look up a pinned DNS RR type mnemonic or its numeric code.
- [Email address list deduplicate](/tools/email-address-list-deduplicate): Drop duplicate mailboxes in an RFC 5322 address-list, keeping the first one.
