A DNS TTL (time to live) tells resolvers how long they may cache a record. Long TTLs mean fewer lookups, faster responses and resilience if your DNS provider has trouble; short TTLs mean changes take effect quickly. Choosing well, and planning changes around TTLs, avoids most DNS surprises.
How caching actually works
When a visitor's resolver looks up www.example.com, it caches the answer for the record's TTL. Until it expires, every visitor using that resolver gets the cached answer, even if you change the record. Some resolvers cap or extend TTLs; treat the TTL as an approximate upper bound for propagation, not a guarantee.
Typical values
| Record | Typical TTL | Why |
|---|---|---|
| Stable A/AAAA/CNAME for the website | 1 hour to 1 day | Rarely changes; fewer lookups |
| Records you may need to fail over | 1 to 5 minutes | Fast switching during incidents |
| MX | 1 hour to 1 day | Mail servers change rarely |
| TXT for verification, SPF, DMARC | 1 hour or more | Rarely changes |
| NS records | 1 to 2 days | Set by the registry and provider |
Managed DNS providers and CDNs often recommend their own values; follow them where they apply to proxied records.
Negative caching
When a name does not exist, resolvers cache the "NXDOMAIN" answer for a time taken from the zone's SOA record. If you create a record that someone recently looked up and did not find, they may keep getting NXDOMAIN until that negative cache expires. See DNS_PROBE_FINISHED_NXDOMAIN.
Planning a change
- Lower the TTL in advance: at least one full old TTL before the change (if the TTL is 1 day, lower it to 5 minutes at least a day earlier).
- Make the change.
- Verify at the authoritative servers, then from several public resolvers.
- Keep the old target running until traffic to it stops.
- Raise the TTL again once you are confident.
dig +noall +answer www.example.com @ns1.your-dns-host.com # authoritative answer and TTL
dig +noall +answer www.example.com @1.1.1.1 # a public resolver's cached TTL counting down
Worked example
A team migrated their API to a new load balancer by changing an A record with a 24-hour TTL. For most of the next day a share of clients kept connecting to the old address, which they had already shut down, producing timeouts that looked like an outage. On the next migration they lowered the TTL to 300 seconds two days ahead, ran old and new in parallel for an hour after the change, and saw no client errors.
Resilience
Long TTLs help if your DNS provider has an outage: resolvers keep serving cached answers. Some teams use two DNS providers for critical zones. Either way, monitor the records that matter.
Monitoring DNS
Check critical records (A, AAAA, CNAME, MX, TXT, NS) against expected values from several locations, and alert on unexpected changes, which can indicate mistakes or hijacking. VitalRix DNS checks confirm records resolve to expected values; see DNS monitoring. Pair them with uptime checks on the same hostnames.
Common mistakes
- Changing a record with a long TTL and expecting it to apply immediately.
- Forgetting negative caching for newly created names.
- Very short TTLs everywhere, increasing lookups and dependence on DNS availability.
- Not monitoring NS records, which change everything if altered.
DNS and failover
DNS-based failover (pointing a name at a standby during an incident) only works as fast as the TTL lets resolvers see the change, and some clients cache longer. For fast failover, prefer a load balancer or anycast address that stays the same while traffic behind it moves, and keep DNS changes for planned migrations.
Related reading
Check records after every change with DNS monitoring, and pair DNS checks with uptime checks on the same hostnames. For TLS certificates that depend on DNS challenges, see TLS certificate automation.
What is a good default DNS TTL?
For stable records, 1 hour is a reasonable default. Use minutes for records you may need to change quickly.
Why do some users still see the old IP after the TTL?
Some resolvers and clients cache longer than the TTL, and long-lived connections keep using the old address. Keep the old target running for a while.
Do low TTLs slow down my site?
They cause more lookups, which add a little latency for some visitors. For most sites the effect is small; balance it against how fast you need changes to apply.
Try VitalRix free
Uptime monitoring, APM, logs, real user monitoring and status pages in one place. No credit card needed.