Every DNS record carries a time to live, or TTL, measured in seconds. It tells resolvers how long they may keep the answer before asking again. For web pages a long TTL is mostly a performance detail. For email it shapes how quickly a change takes effect, how long a mistake lingers and how well your mail survives a DNS outage. A wrongly set MX record with a 24-hour TTL stays wrong in many caches for a day; a very short TTL on all records raises query load and makes you more sensitive to resolver hiccups. This guide explains how caching works for email-related records, gives recommended TTLs for each record type, describes a safe procedure for migrations and explains negative caching, a frequent source of confusion. It builds on MX records, DNS records for email and workspace MX records.
How caching works for email
When a mail server wants to deliver to example.com, it asks a recursive resolver for the MX records. The resolver caches the answer for the TTL in the response. All later senders using that resolver get the cached answer until it expires. Different resolvers have different cache contents and expiry moments, so a change spreads gradually; there is no single moment when everyone sees the new value. The old TTL, not the new one, governs how long previous answers linger, which is why lowering the TTL only helps once the old TTL has elapsed. Mail transfer agents also remember failures and retry on their own schedule; see retry schedules.
| Cache layer | Behaviour |
|---|---|
| Recursive resolver (ISP, public DNS, enterprise) | Caches answers for the TTL; some enforce a minimum or maximum TTL |
| Mail server local cache | Many MTAs run a local caching resolver; restart or flush if needed |
| Application or library cache | Some code caches lookups internally for the process lifetime |
| Negative cache | Failed lookups (NXDOMAIN, no data) are also cached, for the SOA minimum or negative TTL |
| Operating system cache | Desktops cache too; servers usually rely on a resolver |
Recommended TTLs by record
| Record | Typical TTL | Reasoning |
|---|---|---|
| MX | 1 hour (3600) to 4 hours; 300 during a migration | Governs where inbound mail goes; keep it short enough to repoint quickly in an outage |
| A/AAAA of mail hosts | 1 hour to 1 day | Changes with server replacement; keep consistent with MX TTL |
| SPF TXT | 1 hour to 4 hours | Changed when adding senders; mistakes should not linger |
| DKIM TXT or CNAME | 1 hour to 1 day; shorter during key rotation. See key rotation | Selectors rarely change, but a new key must be visible quickly |
| DMARC TXT | 1 hour to 4 hours; shorter while tightening policy | Policy changes should take effect predictably. See DMARC policies |
| MTA-STS TXT (id) and policy file | Short TXT TTL (for example 5 to 60 minutes) and a controlled max_age | The id signals changes. See MTA-STS |
| TLSA (DANE) | 1 hour to 1 day, longer than key rollover steps. See DANE | Mistakes can block delivery; plan rollovers carefully |
| PTR (reverse DNS) | 1 hour to 1 day; set by your IP provider. See FCrDNS | Often not under your control |
| CNAME for tracking or return-path | 1 hour to 1 day | Provider-managed; check their recommendation |
| NS records and SOA | Per registrar and DNS provider; typically 1 to 2 days for NS | Changing name servers is the slowest change of all |
These are starting points. Providers and platforms often prescribe a value, and some resolvers apply their own limits (many ignore TTLs below 30 to 60 seconds or cap them at a day or more). Very short TTLs such as 30 seconds mostly increase cost and fragility rather than speed.
A safe procedure for changing mail DNS
- Plan the cutover time and note the current TTL of every record you will change (for example MX at 86400).
- Lower the TTL to something like 300 seconds at least one old-TTL period before the change. If the old TTL is 24 hours, lower it two days ahead to be safe.
- Prepare the new destination fully first: mailboxes created, TLS certificate valid, SPF including the new senders, DKIM published, firewall open. Test by connecting directly to the new host. See reading an SMTP transcript.
- Make the change and verify with queries against the authoritative server first, then against several public resolvers.
- Keep the old system running for at least the old TTL plus a safety margin (a few days), forwarding or collecting mail that still arrives. See backup MX risks if considering a fallback.
- Monitor bounces, deferrals and the volume on old and new systems.
- Restore normal TTLs when everything is stable, and record the final values in the inventory.
# Ask the authoritative server directly (bypasses caches)
dig +norecurse MX example.com @ns1.example-dns.net
# Ask a public resolver and watch the remaining TTL count down
dig MX example.com @1.1.1.1
dig MX example.com @8.8.8.8
# Show only answers with TTLs
dig +noall +answer MX example.comNegative caching
If a resolver looks up a record that does not exist, it caches that failure too, for a time defined by the minimum field of the zone's SOA record (limited by the SOA TTL). This matters when you publish a new DKIM selector, SPF record or DMARC record shortly after a sender or checker looked for it and found nothing: the "does not exist" answer can persist for the negative TTL, which is often an hour or more. Consequently a new record sometimes seems to work from one network and not from another. To reduce surprises, publish records before you start using them, keep the SOA negative TTL moderate (for example 300 to 3600 seconds) and do not test a record repeatedly from the same resolver before it is live.
Common mistakes
- Lowering TTL at the moment of the change. It does nothing for answers already cached under the old TTL.
- Leaving a very short TTL forever. It adds load and raises exposure to resolver outages. Raise it again after the change.
- Setting a very long TTL on MX. A day or more makes recovery from a misconfiguration or server failure slow.
- Forgetting related records. A new mail server needs updated A, PTR, SPF and certificates; each has its own TTL.
- Changing name servers without copying all records. Missing DKIM, SPF or MX records on the new servers break mail the moment delegation changes.
- Assuming propagation is instant on checker sites. Online tools query specific resolvers that may hold older answers.
- Several TXT records for one purpose. A leftover old SPF record causes a permanent error regardless of TTL. See SPF errors.
DNS availability matters more than TTL
TTL controls how long answers live, but the bigger risk to email is the DNS service itself. Use at least two name servers on independent networks, preferably at a provider with an availability track record, and keep TTLs long enough that short outages are masked by caches. Some resolvers can serve stale answers during an outage, but you should not depend on it. If your zone is large or changes often, automate it with infrastructure as code and keep a tested copy of all mail-related records.
Verify your records after a change Check SPF, DKIM and DMARC for your domain.
References and further reading
Frequently asked questions
What TTL should I use for MX records?
Commonly one to four hours, lowered to about five minutes before a planned migration.
Why must I lower the TTL ahead of a change?
Resolvers cache answers for the old TTL, so a shorter value only helps after that period has passed.
What is negative caching?
Resolvers also cache that a record does not exist, so a newly published record may appear missing for a while.
Does a very low TTL speed up email changes?
Only to a point. Many resolvers enforce minimums, and very low values raise query load and fragility.
How do I check the TTL of a record?
Use dig and read the TTL column; query the authoritative server for the configured value.