DNS TTL Calculator

Convert TTL seconds to a readable format and compute expiry time.

About This Tool

The DNS TTL Calculator converts Time-to-Live values from seconds to human-readable formats, calculates when cached DNS records will expire, and provides TTL recommendations based on use case categories. TTL (Time-to-Live) determines how long DNS resolvers cache records before querying authoritative nameservers again. Understanding TTL is crucial for DNS change planning, performance optimization, and infrastructure migrations. This tool helps you choose appropriate TTL values, understand caching behavior, and plan DNS record updates with minimal downtime.

How to Use

  1. Enter a TTL value in seconds (e.g., 300, 3600, 86400)
  2. Click "Calculate" to see results
  3. View human-readable format (e.g., "5 minutes", "1 hour", "1 day")
  4. See TTL category classification (very short, short, medium, long, very long)
  5. Check computed expiry time showing when the record will expire from cache
  6. Review recommendations for appropriate use cases
  7. Use recommendations to choose optimal TTL for your DNS records

Features

  • Converts seconds to human-readable time format
  • Calculates exact cache expiry timestamp
  • Categorizes TTL values (very short to very long)
  • Provides use case recommendations
  • Instant calculation
  • Clear category definitions
  • Real-time expiry time display
  • Best practice guidance

Common Use Cases

  • Planning DNS record changes and migrations
  • Choosing appropriate TTL for new DNS records
  • Understanding when DNS changes will propagate
  • Optimizing DNS performance vs. flexibility
  • Planning infrastructure migrations with minimal downtime
  • Troubleshooting DNS caching issues
  • Understanding propagation delays
  • Balancing caching efficiency with update agility
  • Setting TTL for CDN and load balancer endpoints
  • Planning scheduled maintenance windows

Technical Details

DNS TTL (Time-to-Live) is a field in DNS records that specifies how many seconds a resolver should cache the record before querying authoritative nameservers again.

TTL Categories and Common Values:

  • Very Short (< 5 minutes): 60-300 seconds
    • Use case: Active failover, imminent changes, testing
    • Examples: 60s, 120s, 300s
    • Trade-off: High query load, low propagation time
  • Short (5-30 minutes): 300-1800 seconds
    • Use case: Dynamic services, frequent updates, load balancers
    • Examples: 300s (5 min), 600s (10 min), 1800s (30 min)
    • Trade-off: Moderate query load, reasonable flexibility
  • Medium (1-24 hours): 3600-86400 seconds
    • Use case: Stable services, typical websites, mail servers
    • Examples: 3600s (1 hour), 43200s (12 hours), 86400s (1 day)
    • Trade-off: Low query load, slower propagation
  • Long (1-7 days): 86400-604800 seconds
    • Use case: Rarely changing infrastructure, name servers
    • Examples: 86400s (1 day), 172800s (2 days), 604800s (7 days)
    • Trade-off: Very low query load, very slow propagation
  • Very Long (> 7 days): > 604800 seconds
    • Use case: Extremely stable records, rarely used
    • Examples: 2592000s (30 days)
    • Trade-off: Minimal queries, changes take weeks to propagate

How TTL Works:

  1. Client queries resolver for example.com
  2. Resolver checks cache; if not present, queries authoritative nameserver
  3. Authoritative server returns record with TTL (e.g., A 192.0.2.1 TTL 3600)
  4. Resolver caches record for 3600 seconds (1 hour)
  5. Subsequent queries within 1 hour are served from cache
  6. After 1 hour, resolver queries authoritative server again for fresh data

TTL Countdown:

Resolvers decrement TTL as time passes:

  • Cached with TTL 3600 at 12:00 PM
  • At 12:30 PM, TTL is 1800 (30 minutes remaining)
  • At 1:00 PM, TTL is 0 (expires, re-query needed)

Planning DNS Changes:

To minimize downtime when changing DNS records:

  1. Before change: Reduce TTL to 300 seconds (5 min) at least 24-48 hours before
  2. Wait: Wait for old TTL to expire (e.g., if TTL was 86400, wait 1 day)
  3. Make change: Update DNS record to new value with short TTL
  4. Verify: Test and monitor for propagation
  5. After change: Once stable, increase TTL back to normal (e.g., 3600)

Common TTL Values and Use Cases:

  • 60 seconds: Active failover testing, maintenance mode switches
  • 300 seconds (5 min): CDN endpoints, load balancer IPs, pre-change preparation
  • 3600 seconds (1 hour): Web servers, API endpoints, typical websites
  • 86400 seconds (1 day): Mail servers (MX), name servers (NS), stable infrastructure
  • 172800 seconds (2 days): SOA records, zone apex

TTL Trade-offs:

  • Low TTL (60-300s):
    • Pros: Fast propagation, flexibility, quick failover
    • Cons: High query load, increased latency, more authoritative server load
  • High TTL (3600-86400s):
    • Pros: Low query load, reduced latency, less server load
    • Cons: Slow propagation, inflexibility, prolonged outages if records need urgent changes

Negative TTL (NXDOMAIN):

When a domain doesn't exist, resolvers cache the negative response:

  • Controlled by SOA record's minimum TTL field
  • Typically 300-3600 seconds
  • Important when creating new subdomains after NXDOMAIN responses

DNS Resolver Behavior:

  • Most resolvers respect TTL values
  • Some may enforce minimum TTL (e.g., 30 seconds) to prevent abuse
  • Some may cache longer than TTL during outages
  • Browser DNS caching adds additional layer (typically short)

Performance Considerations:

  • Each DNS query adds 10-100ms latency
  • Lower TTL = more queries = higher total latency for users
  • Higher TTL = fewer queries = lower authoritative server load and cost
  • CDN providers often recommend 300-600s TTL for endpoints

Best Practices:

  • Use 3600s (1 hour) for most stable web services
  • Use 300s (5 min) for dynamic or load-balanced endpoints
  • Use 86400s (1 day) for MX, NS, and rarely-changing records
  • Lower TTL 24-48 hours before planned DNS changes
  • Never set TTL below 60 seconds unless absolutely necessary
  • Document TTL decisions for operational clarity