DNS TTL
Learn what DNS TTL is, how it controls caching and propagation speed, recommended values for different use cases, how to manage TTL before changes, and common mistakes to avoid.
Understanding DNS TTL (Time To Live)
TL;DR
TTL (Time To Live) is a value (in seconds) that tells DNS resolvers how long to cache a record before checking for updates.
- Low TTL → fast changes, but more queries
- High TTL → fewer queries, but changes take longer to propagate
Best practice: lower TTL before making changes, then raise it after propagation.
What Is TTL and How Does It Work?
TTL is included in every DNS response from an authoritative server.
When a resolver (e.g., your ISP's DNS, Google 8.8.8.8) receives a record, it caches it for exactly that many seconds.
Caching flow:
- Resolver asks for
example.com A - Authoritative server replies: record + TTL = 3600
- Resolver caches it and answers from cache for 3600 seconds
- After 3600s, the next query goes back to the authoritative server
Note: Negative caching—NXDOMAIN or NODATA responses, are also cached (using SOA MINIMUM or record TTL).
Frequently Asked Questions
What happens if I don't set a TTL?
Your DNS provider applies a default (usually 3600 s or 1 hour).
Does TTL affect only my authoritative server or also resolvers?
It affects every caching resolver that receives the record.
Can TTL be different for each record?
Yes, each record can have its own TTL.
How do I see the actual TTL in use?
Run:
The number before the record type (e.g., "299 IN A ...") is the remaining TTL from Google's cache.
dig @8.8.8.8 example.com A or nslookup:dig example.com ARelated Topics
- How to Check DNS Propagation: Verify changes across resolvers
- A Record: IPv4 address records
- AAAA Record: IPv6 address records
- MX Record: Mail exchange records
- CNAME Record: Canonical name records