TTL (Time to Live) is a numeric value in DNS records that tells DNS resolvers how long to cache (store) that record before querying the authoritative nameserver for a fresh copy. It is measured in seconds.
How TTL Works
- A resolver queries the authoritative nameserver and receives a DNS record with TTL = 3600.
- The resolver caches the record for 3600 seconds (1 hour).
- During that hour, all queries from that resolver return the cached value — no new network lookups needed.
- After 3600 seconds, the cache expires and the resolver fetches a fresh copy from the authoritative server.
Common TTL Values
- 300 seconds (5 min) — Propagates changes quickly. Use before planned server migrations.
- 3600 seconds (1 hour) — A reasonable default for most records.
- 86400 seconds (24 hours) — For stable records rarely changed (MX, NS). Reduces DNS query volume.
TTL Strategy for DNS Migrations
Before changing a server's IP address:
- Lower the TTL to 300 seconds at least 24–48 hours before the change (to let old cached values expire first).
- Make the DNS change (update the A record).
- Wait for propagation (~5 minutes with low TTL).
- Restore the TTL to a longer value once the change is confirmed working.
TTL and Email Records
MX and SPF records should have moderate TTLs (3600). Very short TTLs on mail records can cause intermittent delivery failures during the lookup window.