What is TTL in DNS? - The Expert Guide

Reading time: 6 min read
Aditya Rayaprolu
Written by
Aditya Rayaprolu

Updated · Jul 26, 2023

Aditya Rayaprolu
Technology Architect | McKinsey & Company | Joined February 2023 | LinkedIn
Aditya Rayaprolu

Aditya is an Azure DevOps and Infrastructure Virtualization Architect with experience in automation,... | See full bio

Florence Desiata
Edited by
Florence Desiata


Florence Desiata
Joined June 2023 | LinkedIn
Florence Desiata

Florence is a dedicated wordsmith on a mission to make technology-related topics easy-to-understand.... | See full bio

Techjury is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission. Learn more.

TTL is a numerical value that defines the time it takes for a data packet to exist on a computer or network before it gets discarded. 

This article will look at what TTL is in relation to DNS. This is different from CDN TTL, another context in which TTL exists. So, let’s see why this matters, what the best practices are, and more.

What is TTL in DNS

DNS Time to Live (TTL) is the amount of time a record remains in the cache of a DNS server before it’s refreshed. It signifies how long records stay cached in a DNS server’s memory after the server has located a host’s matching IP address.

TTL is a primary element of Domain Name Server or DNS. All websites have them set by default or by the domain owners.

Depending on the numerical value, the DNS resolver knows how long to cache a query before it requests a new one from the authoritative name server.

A DNS TTL value is set in seconds. For example, if it’s set to 600 seconds, it will take 10 minutes before a DNS record is discarded from the cache memory. On the other hand, if it is set to 86,400 seconds, the record will stay cached for 24 hours. 

DNS TTL can play a vital role in improving visitors' experience to a website. This is especially true for websites that make frequent updates. 

How does this play out practically?

Say a user enters a URL into a browser to bring up a website. The user is unwittingly asking the local DNS resolver or requester for the domain’s IP address. 

But what if someone else recently made that same request?

In that case, the record of that query will likely be stored in the DNS resolver’s cache memory. The extent of the time it remains there depends on the TTL value

So, if the domain name owner sets the TTL for 3600 seconds (which equals 1 hour) and the user accesses the URL within an hour of the last user, then the resolver will not query the authoritative name server again. Instead, it’ll retrieve it from the cache memory, speeding up the DNS resolution process.

On the other hand, after an hour is up, the record is discarded from the cache memory. Now for any requests to access that URL, the resolver requests the domain from the authoritative name server all over again. 

What Are the Different TTL Values

As established, TTL values are set in seconds. For instance, a TTL value of 300 is the equivalent of 300 seconds or 5 minutes, a value of 900 is 15 minutes long, and so on.

You can set a TTL value for as little as 1 second. However, in practice, the minimum time-to-live is usually 30. Most sites have a default DNS TTL value of 3600 or one hour.

There are five Start of Authority (SOA) TTL values that can impact your website’s performance.

  • SOA TTL: This is the interval where the SOA record refreshes.
  • Refresh TTL: This is the interval where secondary servers refresh the data from the authoritative name server. This ensures that visitors view the latest updates.
  • Retry TTL: If the initial refresh above fails, a secondary server will try to refresh the data from the authoritative name server several times. The value here is typically an hour or less.
  • Expiry TTL: If the last two processes above fail after many tries, the DNS record expires. Afterward, the record is considered outdated and can no longer be used.
  • NX TTL: This is the interval that a non-existent query (NXDOMAIN) is cached.

Why Does TTL Matter? 

A primary concern for website owners is how much time it takes web pages to load. 

There’s a good reason for this. Statistics show that 53% of website visitors will leave if a page takes 3 seconds or longer to load. Slow and steady wins no races here. 

Fortunately, there are ways to improve a website’s loading time. One of them involves adjusting the site’s TTL. 

DNS TTL is a vital element for websites. Most websites incorporate large amounts of text, images, videos, and other data. If they had to load from scratch every time there’s a visitor, it would slow performance.

That is what makes TTL in DNS so important.

The higher the DNS TTL, the less frequently a DNS record has to be dug up from the authoritative name server. The cached site stays up longer before it updates, making your website load quicker. This also puts less pressure on the authoritative name server.

Although a shorter TTL also has its uses, especially for websites that update their content frequently. These websites cannot afford to have visitors view content that is already redundant.

DNS TTL Best Practices 

By now, you’ve understood there’s an implied trade-off between the DNS TTL and the number of queries. That said, there are factors to consider when choosing the TTL value for a website.

When you should use a long TTL

Longer TTLs maximize cost benefits for many website owners. They are ideal for static websites that don’t undergo frequent updates or changes. Because the content on these websites doesn’t turn over quickly, users aren’t hit with redundant information due to long-term caching. 

As a result of long DNS TTL, there are fewer lookups, lower costs, and faster load times. In addition, there is significantly less pressure on the name server.

When you should use a short TTL

The benefits of longer TTL values do not apply to every website. Sites that frequently revise their records need the cache to expire faster. That way, record queries occur more frequently, providing the latest information to users.

Another benefit of shorter values is when moving domains to new servers. TTL values set to shorter intervals direct users to the new IP in as little time as possible.

Wrap Up 

The TTL in DNS is a vital setting that allows a domain owner to control how long a site’s information stays up before updates get dug up. 

They have values (in seconds) that signify how long each record stays in the cache memory. The standard interval for most websites is an hour long. 

The ideal TTL value helps keep down a website’s load time and ensure that content stays up to date.


What is a good TTL for DNS?

An ideal TTL depends on the frequency that updates occur on a website. The standard TTL value for most sites is 3600 - equivalent to one hour. 

What does TTL 1 hour mean?

This means that the TTL was set to 3600 seconds, representing the time a DNS record stays cached. After that time, the DNS resolver will request new records from the authoritative name server.

Is higher or lower TTL better?

This depends on the frequency of changes in the website. Websites with more frequent changes will benefit from lower DNS TTL values and vice versa.

What is the purpose of TTL?

The TTL limits the time that data lives within a computer or network. This may lead to the question of what is TTL in DNS? This signifies how long DNS records remain in cache memory before they are refreshed.


Facebook LinkedIn Twitter
Leave your comment

Your email address will not be published.