TTL is probably the most useful number in DNS and the one people leave on its default. It stands for "time to live", and it's a countdown in seconds attached to every DNS answer. It tells resolvers how long they may reuse that answer before asking again. Get it right and DNS changes become boring. Get it wrong and you spend an afternoon refreshing a page.

How TTL works

When a resolver fetches a record from your nameserver, it receives the value and the TTL. It stores both, counts down while it serves the stored copy, and once the clock reaches zero it discards the copy and asks again. We can see that in a real answer. Asking a resolver for example.com returned this:

example.com.  300  IN  A  172.66.147.243
example.com.  300  IN  A  104.20.23.154

The 300 means "keep this for five minutes". A request a minute later would show a number near 240, because the resolver counts down in its cache. That's also why the same lookup, done on two resolvers, rarely shows the same TTL.

The trade-off in one sentence

A short TTL makes changes fast and queries frequent; a long TTL makes queries rare and changes slow. Everything else follows from that.

With a low TTL, any change reaches visitors in minutes, and you can switch to a backup server quickly. The costs are more queries to your DNS provider (some bill per million), and slightly slower page loads for first-time lookups because cached answers expire sooner.

With a high TTL, resolvers rarely come back, so lookups feel quick and your DNS bill shrinks. The cost is that a mistake or a migration lingers: visitors keep getting the old answer until their copy expires, and there's nothing you can do to hurry it up.

Sensible values by record type

  • A and AAAA for your main site: 300 to 3600 seconds. Go to the low end if you might need to fail over quickly, or if the address changes with your hosting.
  • CNAME records pointing at a service: 300 to 3600. Services change their targets, and your alias follows.
  • MX records: 3600 or more. Mail servers retry, so a slow change is rarely harmful, and you seldom change them.
  • TXT records for verification, SPF and DKIM: 3600 is typical. Drop it while you're experimenting with a new setup.
  • NS records: 86400 (one day) at your provider. The delegation at the registry is out of your hands: for .com it's 172800, two days.
  • Failover or load-balanced records: 30 to 60 seconds, if your provider supports it.

Plenty of hosts default to 14400 (four hours) or even 86400. That's fine for quiet records, but it's a bad surprise when you finally need a fast change.

Plan a change around the old TTL

This is the practical heart of the whole subject. The time a change takes is governed by the TTL that resolvers already hold, not the one you set afterwards. So lowering it at the moment of the change does nothing useful.

Here's a typical timeline for moving a site whose A record has a TTL of 3600:

  1. Monday 09:00: lower the TTL to 300. Resolvers still hold the old one-hour copies.
  2. Monday 10:00 or later: every cache has now expired its old copy and re-fetched with the five-minute TTL.
  3. Tuesday: switch the IP address. Within about five minutes, almost everyone sees it.
  4. Tuesday afternoon: check that every location shows the new value, using the DNS propagation checker.
  5. Wednesday: raise the TTL back to 3600 or higher.

For a deeper look at what happens on the wire during that wait, read our guide to DNS propagation time. If you're changing nameservers rather than a record, the rules are stricter, and the nameserver checklist applies.

Negative caching: the TTL for "does not exist"

Resolvers cache failures too. If a name doesn't exist, the "no such domain" answer is remembered for a time set by the last field of the SOA record. For example.com that number is 1800, half an hour. It matters when you create a brand-new subdomain right after someone, or some automated tool, queried it; a few visitors may be told it doesn't exist for a while even though it does now.

What can override your TTL

  • Resolvers with their own limits. Some enforce a minimum, maximum or both, whatever you publish.
  • Operating systems and browsers. They keep their own short caches. Flushing them helps on your own machine.
  • CDNs and proxies. When a provider proxies your record, the TTL visitors see may be fixed by them, regardless of what you set at the origin.
  • Stale serving. Some resolvers will reuse an expired answer briefly if your nameserver is unreachable. That's helpful during an outage but can confuse a debugging session.

A few quick rules to keep

  • Never schedule a change on the same day you lower the TTL.
  • Don't leave a 300-second TTL on everything forever without reason.
  • Do keep a note of the TTL you're returning to, so you don't forget to restore it.
  • Do check what the world actually sees instead of trusting the control panel. The TTL printed next to each location in our checker tells you how much longer a laggard may take.

Used well, TTL is the quiet setting that turns DNS migrations from nerve-racking into routine. Choose it for the job each record does, plan around the old value, and you'll rarely wait on propagation again. It also plays a part in outages, which we cover in DNS and website downtime.