DNS response codes — RCODEs — are the small numeric status returned in every DNS reply telling you whether the lookup succeeded and, if not, why. Reading them correctly is the fastest way to tell a missing record apart from a broken resolver or a deliberate policy block. This reference lists the standard codes from the DNS header plus the extended values carried by EDNS and TSIG, each with its RFC and a diagnostic note.
How it works
The original DNS header reserves only 4 bits for the RCODE, so values 0–15 fit inside a normal response. Anything larger is an extended RCODE: the high bits live in the EDNS0 OPT pseudo-record (RFC 6891) or in TSIG/TKEY signature data (RFC 8945). That is why a tool like dig only shows codes such as BADVERS or BADTIME when EDNS or transaction signatures are present.
The most common everyday codes are NOERROR (0), SERVFAIL (2), NXDOMAIN (3) and REFUSED (5). Note that value 16 is overloaded: in an EDNS context it means BADVERS (unsupported OPT version), and in a TSIG context it means BADSIG (signature failure).
Tips and examples
When debugging, map the code to a cause before changing anything:
NXDOMAIN -> the name genuinely does not exist (check for typos / delegation)
SERVFAIL -> resolver problem: upstream down or DNSSEC validation failed
REFUSED -> policy: recursion off, ACL, or zone-transfer denied
NOERROR + 0 answers -> name exists but not for that record type
A frequent DNSSEC pitfall: a validating resolver returns SERVFAIL for a zone with a broken signature, while a non-validating resolver returns the records normally — the difference points straight at a DNSSEC misconfiguration rather than the records themselves.