EDNS Size Estimator

Estimate DNS response size and fragmentation risk.

About This Tool

The EDNS Size Estimator calculates DNS response packet sizes and assesses fragmentation risk, helping prevent DNS resolution failures and performance degradation. DNS responses larger than ~1232 bytes risk UDP fragmentation, which can be blocked by firewalls or dropped by networks, causing timeouts and forcing fallback to TCP. This tool estimates total response size based on query name, record type, and answer records, providing UDP safety analysis and recommendations. Whether you're configuring DNSSEC, managing large TXT records, or optimizing authoritative server responses, this estimator helps ensure your DNS responses traverse the internet reliably.

How to Use

  1. Enter the queried domain name (e.g., example.com)
  2. Select the query record type (A, AAAA, CNAME, MX, TXT, SRV, CAA)
  3. Enter answer records as JSON array in the textarea
  4. JSON format: [{"name":"example.com","type":"A","value":"1.2.3.4"}]
  5. Include all records that would appear in the response section
  6. Click "Estimate" to calculate response size
  7. Review total size, UDP safety status, and fragmentation risk
  8. Follow recommendations to optimize response size if needed

Features

  • DNS response packet size estimation
  • UDP safety threshold checking (1232 bytes)
  • Fragmentation risk assessment (low/medium/high)
  • Per-record size calculation
  • Base query overhead calculation
  • EDNS(0) buffer size recommendations
  • Actionable optimization suggestions
  • Support for A, AAAA, CNAME, MX, TXT, SRV, CAA records
  • JSON input format for flexibility
  • Clear safety indicators

Common Use Cases

  • Preventing DNS resolution failures due to fragmentation
  • Optimizing DNSSEC-signed responses
  • Managing large TXT records (SPF, DKIM, DMARC)
  • Planning DNS record additions without breaking UDP
  • Troubleshooting intermittent DNS timeout issues
  • Validating DNS infrastructure changes
  • EDNS(0) buffer size configuration
  • Authoritative server response optimization
  • Understanding when TCP fallback will occur
  • Capacity planning for DNS servers

Technical Details

DNS originally used UDP with a 512-byte limit. EDNS(0) extended this, but UDP fragmentation remains problematic. Understanding response sizes prevents resolution failures.

UDP Size Limits and Fragmentation:

  • Original DNS: 512 bytes maximum (RFC 1035)
  • EDNS(0): Advertises larger buffer sizes (RFC 6891)
  • Safe UDP size: ~1232 bytes (avoids fragmentation)
  • MTU considerations: 1500-byte Ethernet MTU - IP/UDP headers = ~1472 usable
  • Conservative limit: 1232 bytes accounts for tunneling overhead (VPN, IPv6-in-IPv4)

Why Fragmentation is Problematic:

  • Firewalls: Many drop fragmented UDP packets for security
  • Routers: Some discard fragments to prevent attacks
  • Networks: Fragments can be lost independently, breaking reassembly
  • Path MTU issues: ICMP "Packet Too Big" messages often blocked
  • Result: DNS query timeout, fallback to TCP (slower)

DNS Packet Size Calculation:

  • Header: 12 bytes (fixed)
  • Question section: Name (variable) + type (2) + class (2)
  • Answer section: Records with name, type, class, TTL, data length, data
  • Authority section: Optional NS records
  • Additional section: Optional A/AAAA for NS, EDNS OPT pseudo-record

Record Size Components:

  • Name: Compressed or uncompressed (1-255 bytes typically)
  • Type: 2 bytes (A=1, AAAA=28, TXT=16, etc.)
  • Class: 2 bytes (IN=1)
  • TTL: 4 bytes
  • RDLENGTH: 2 bytes
  • RDATA: Variable (4 bytes for A, 16 for AAAA, etc.)

Example Size Estimates:

  • A record: ~16 bytes (name compressed) + 4 bytes (IPv4) = 20 bytes
  • AAAA record: ~16 bytes + 16 bytes (IPv6) = 32 bytes
  • MX record: ~16 bytes + 2 (priority) + domain (~20) = 38 bytes
  • TXT record: ~16 bytes + text length (variable, often 100-500 bytes)

Fragmentation Risk Levels:

  • Low (< 1232 bytes): Safe for UDP, no fragmentation expected
  • Medium (1232-1472 bytes): May fragment on some networks, generally works
  • High (> 1472 bytes): Will fragment, high risk of delivery failure
  • Very High (> 4096 bytes): Almost certainly will fail UDP, TCP fallback required

DNSSEC Impact on Size:

  • RRSIG records add 100-300 bytes per signed RRset
  • DNSKEY records add 200-500 bytes
  • DS records add 50-100 bytes
  • DNSSEC can easily push responses over 1232 bytes
  • Many zones with DNSSEC require TCP fallback

TCP Fallback Process:

  1. Resolver sends UDP query with EDNS(0) buffer size (e.g., 4096)
  2. Server responds, but response > 1232 bytes fragments
  3. Fragments are dropped by firewall or lost in transit
  4. Resolver times out (typically 2-5 seconds)
  5. Resolver retries with TCP (adds latency)
  6. TCP query succeeds but is slower (handshake + transmission)

Optimization Strategies:

  • Reduce record count: Return only essential records in answer section
  • Shorter names: Use shorter domain names where possible
  • Split TXT records: Break long TXT into multiple smaller records
  • Trim authority section: Omit NS records if not essential
  • Minimize additional section: Rely on resolver's cache for glue records
  • EDNS(0) buffer size: Advertise realistic sizes (1232-4096)

Common Problem Scenarios:

  • Large SPF records: "v=spf1 include:... include:... ~all" with many includes
  • DKIM keys: Long RSA public keys in TXT records (>512 characters)
  • Multiple A records: 20+ A records for load balancing
  • DNSSEC signed zones: RRSIG adds significant overhead
  • CAA records: Multiple CAA records with long properties

EDNS(0) Buffer Size Recommendations:

  • Resolvers should advertise: 1232 bytes (modern recommendation, RFC 6891 update)
  • Authoritative servers: Should truncate (TC bit) if response > advertised buffer
  • Avoid large buffers: 4096-byte buffers encourage responses that will fragment
  • Flag Day 2020: Industry moved to 1232-byte default to reduce fragmentation

Testing and Verification:

  • Use dig +bufsize=1232 +ignore to test UDP response size
  • Check for TC (truncated) flag in response
  • Monitor resolver logs for TCP fallback frequency
  • Test from multiple network locations (home, mobile, cloud)

Best Practices:

  • Keep DNS responses under 1232 bytes when possible
  • Test response sizes before deploying DNSSEC
  • Split overly long TXT records into multiple records
  • Use shorter domain names in critical paths
  • Monitor for increased TCP fallback after DNS changes
  • Consider DNS over TCP for zones that consistently exceed limits