########################################################################
# owuitools prompt test result
# prompt dir : medium/m09-dns-name-limits (round v2)
# chat id    : a1da259d-32d5-4f2d-9b1c-94ee00953ad4
# chat title : DNS Label Length and Domain Name
# user       : the operator
# model      : qwen3.8:latest
# turns      : 2 messages on selected branch
# tool calls : 1  lookup_rfc x1
# dumped at  : 2026-09-11T20:04:33Z
########################################################################

=== USER  (2026-09-11T20:03:23Z) ===
Per the RFC, what’s the maximum length of a single DNS label, and of a complete domain name? Cite the RFC number and section. I’ve seen both 253 and 255 quoted for the name - which is right?

=== ASSISTANT  (2026-09-11T20:03:23Z, model qwen3.8:latest) ===
usage: prompt_eval_count=11144 eval_count=1021 prompt_tokens=11144 completion_tokens=1021 total=30.7s prefill=3.7s decode=26.9s 38.0 tok/s

=== [1] THINKING ===
The user is asking about the maximum length of a DNS label (63 octets) and the maximum length of a full domain name (255 octets), along with the RFC number and section. The confusion between 253 and 255 comes from the fact that 255 includes the root label terminator (null character) and the length byte.

Let me check the relevant RFCs. Main candidates:
- RFC 1035 (the original Domain Names — Implementation and Specification)
- RFC 4034 (DNSSEC, updated version)
- RFC 1035 Section 2.3.4 states "in defining a domain name, an implementation must limit any one label to 63 octets or less" and "a total of 255 octets or less for a domain name."

RFC 1035 Section 2.3.4: "In defining a domain name, an implementation must limit any one label to 63 octets or less. A total of 255 octets or less is allowed for an entire domain name."

Also, Section 4.1.4 (message compression) — regarding the 255. And Section 5.1... Actually, the well-known citation is RFC 1035 §2.3.4.

The 253 vs 255 issue: 255 is the maximum size of the full domain name in wire format including the trailing root label (a single zero octet). Therefore, the actual printable domain name (without the trailing dot) is 253 characters. Both are correct depending on context: 255 octets in wire format including the root terminator, 253 characters in text form.

Let me check with lookup_rfc.

=== [2] TOOL CALL: lookup_rfc  (call_ogapujcw) ===
{
  "number": 1035,
  "search": "63 octets"
}

=== [3] TOOL RESULT: lookup_rfc  (call_ogapujcw) ===
# RFC 1035
Source: https://www.rfc-editor.org/rfc/rfc1035.txt

[Jumped to '63 octets' at character 23,832 of 114,114]

…
ns are preserved.

2.3.4. Size limits

Various objects and parameters in the DNS have size limits.  They are
listed below.  Some could be easily changed, others are more
fundamental.

labels          63 octets or less

names           255 octets or less

TTL             positive values of a signed 32 bit number.

UDP messages    512 octets or less

3. DOMAIN NAME SPACE AND RR DEFINITIONS

3.1. Name space definitions

Domain names in messages are expressed in terms of a sequence of labels.
Each label is represented as a one octet length field followed by that
number of octets.  Since every domain name ends with the null label of
the root, a domain name is terminated by a length byte of zero.  The
high order two bits of every length octet must be zero, and the
remaining six bits of the length field limit the label to 63 octets or
less.

To simplify implementations, the total length of a domain name (i.e.,
label octets and label length octets) is restricted to 255 octets or
less.

Although labels can contain any 8 bit values in octets that make up a
label, it is strongly recommended that labels follow the preferred
syntax described elsewhere in this memo, which is compatible with
existing host naming conventions.  Name servers and resolvers must
compare labels in a case-insensitive manner (i.e., A=a), assuming ASCII
with zero parity.  Non-alphabetic codes must match exactly.

3.2. RR definitions

3.2.1. Format

All RRs have the same top level format shown below:

                                    1  1  1  1  1  1
      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                                               |
    /                                               /
    /                      NAME                     /
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                      TYPE                     |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                     CLASS                     |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                      TTL                      |
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                   RDLENGTH                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
    /                     RDATA                     /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:

NAME            an owner name, i.e., the name of the node to which this
                resource record pertains.

TYPE            two octets containing one of the RR TYPE codes.

CLASS           two octets containing one of the RR CLASS codes.

TTL             a 32 bit signed integer that specifies the time interval
                that the resource record may be cached before the source
                of the information should again be consulted.  Zero
                values are interpreted to mean that the RR can only be
                used for the transaction in progress, and should not be
                cached.  For example, SOA records are always distributed
                with a zero TTL to prohibit caching.  Zero values can
                also be used for extremely volatile data.

RDLENGTH        an unsigned 16 bit integer that specifies the length in
                octets of the RDATA field.

RDATA           a variable length string of octets that describes the
                resource.  The format of this information varies
                according to the TYPE and CLASS of the resource record.

3.2.2. TYPE values

TYPE fields are used in resource records.  Note that these types are a
subset of QTYPEs.

TYPE            value and meaning

A               1 a host address

NS              2 an authoritative name server

MD              3 a mail destination (Obsolete - use MX)

MF              4 a mail forwarder (Obsolete - use MX)

CNAME           5 the canonical name for an alias

SOA             6 marks the start of a zone of authority

MB              7 a mailbox domain name (EXPERIMENTAL)

MG              8 a mail group member (EXPERIMENTAL)

MR              9 a mail rename domain name (EXPERIMENTAL)

NULL            10 a null RR (EXPERIMENTAL)

WKS             11 a well known service description

PTR             12 a domain name pointer

HINFO           13 host information

MINFO           14 mailbox or mail list information

MX              15 mail exchange

TXT             16 text strings

3.2.3. QTYPE values

QTYPE fields appear in the question part of a query.  QTYPES are a
superset of TYPEs, hence all TYPEs are valid QTYPEs.  In addition, the
following QTYPEs are defined:

AXFR            252 A request for a transfer of an entire zone

MAILB           253 A request for mailbox-related records (MB, MG or MR)

MAILA           254 A request for mail agent RRs (Obsolete - see MX)

*               255 A request for all records

3.2.4. CLASS values

CLASS fields appear in resource records.  The following CLASS mnemonics
and values are defined:

IN              1 t
…

[Showing the region around '63 octets'. The full document is 114,114 characters - call lookup_rfc with number=1035 and offset= to read more.]

=== [4] THINKING (18s) ===
The RFC's text backs up my answer. Let me explain the difference between 253 and 255.

RFC 1035 §2.3.4 "Size limits": labels are 63 octets or less, names are 255 octets or less.

§3.1: "To simplify implementations, the total length of a domain name (i.e., label octets and label length octets) is limited to 255 octets or less."

So 255 is the limit on the wire format: it includes the label length octets and the trailing null root label. In text form (dots as separators), the maximum length of a fully qualified domain name ending in the root dot is 255 − 2 = 253 characters: 255 includes the final zero-length byte (1 octet) and the length byte of the last label... no wait, let me think carefully.

Wire format: each label = 1 length octet + N data octets; the name ends with a zero octet. Total ≤ 255 octets.

Text form: for example, "a.b.c." — if all labels are 63 characters... the maximum text representation is: (k−1) dots + total label characters + final dot. If the wire total is 255, then sum(label lengths) + k (length bytes, one per label) + 1 (root zero) = 255. Text form = sum(label lengths) + k dots (k−1 separators + 1 trailing). So text = 255 − 1 (root zero) = 254? Hmm.

Wait: text characters = sum of label data octets + number of dots. Dots = k (k−1 separators + trailing root dot). Wire = sum(labels) + k length bytes + 1 root zero octet = 255. Therefore sum(labels) + k = 254, so text = 254 characters including the trailing dot, or 253 without the trailing dot.

So the commonly quoted figure: 253 characters for a fully qualified domain name (without the trailing dot). This matches the widely known fact that "the maximum length of a domain name is 253 characters." For example, the 253-character limit on IDN A-labels in RFC 5890/5891. In fact, RFC 5891 states that the maximum length of a domain name is 253 octets (excluding the trailing root dot).

So both are correct: 255 octets is the wire-format limit (RFC 1035 §2.3.4, §3.1), and 253 is the maximum length of the printable name excluding the final dot.

Note: RFC 1035 has been obsoleted by RFC 1123, but the size limits remain unchanged. Also, modern UDP messages can be larger due to EDNS0 (RFC 6891), but that's not what was asked.

I'll answer concisely with citations.

=== [5] ASSISTANT TEXT ===
Both numbers are right — they measure different things. The authoritative text is **RFC 1035** (Domain Names — Implementation and Specification):

- **§2.3.4 "Size limits"**: 
  > labels — 63 octets or less
  > names — 255 octets or less

- **§3.1** explains what the 255 covers:
  > "To simplify implementations, the total length of a domain name (i.e., label octets and label length octets) is restricted to 255 octets or less."

**Why 253 also shows up:** on the wire, each label is encoded as a length byte + its data bytes, and every name ends with a zero-length root label. So the 255-octet budget includes all the per-label length bytes *and* the trailing null byte. When you translate that into the printable form (`a.b.c.`), the arithmetic works out to **253 characters maximum excluding the final dot** (254 if you count it). That's why tools and specs like RFC 5891 (IDNA) quote 253 for the textual name while the DNS wire-format limit stays 255.

So: **63 octets per label, 255 octets for the full name in wire format (RFC 1035 §2.3.4), which corresponds to 253 characters in text form without the trailing root dot.** Neither figure is wrong — just make sure you're consistent about which representation you mean.

=== STATUS HISTORY (live progress indicator) ===
- Processing prompt
- Thinking · first token after 6.0 s
- Thought: The user is asking about the maximum length of a DNS label (63 octets) and the maximum … 253 characters in text form. Let me check with lookup_rfc.
- Calling lookup_rfc
- Thinking
- Thought: The RFC's text backs up my answer. Let me explain the difference between 253 and 255. … not what was asked. I'll answer concisely with citations.
- Writing response
- Done · 1 tool call · prefill 5.8 s for 12,701 tokens · 1,454 generated
