TL;DR
Time to live (TTL) is a built-in expiration mechanism embedded in internet data packets that automatically discards or refreshes information once it reaches its hop or time limit. Originally defined by the Network Working Group in 1981 as part of ICMP, TTL governs Internet Protocol (IP) packets, Domain Name System (DNS) record caching, and HTTP cache expiry — keeping internet traffic clean, current, and efficient.
What is TTL and how does it work?
Time to live, or TTL, is an expiration date for information passing across the internet. When the data hits its limit, it's dropped or revised.
TTL limits ensure that the internet isn't cluttered with old, outdated requests. TTL can also ensure that you're working with the newest and latest piece of information you've requested.
In 1981, the Network Working Group defined TTL as part of the Internet Control Message Protocol (ICMP). These rules describe how information passes across the internet.
Per the ICMP, TTL is:
- Measured in seconds
- Placed within the IP header
- At least as long as the number of gateways (or routers) the message will pass through
Let's break this down into layman's terms.
How does TTL work inside an IP packet?
When you create a piece of information and send it across the internet, you use ICMP. The unit of information is called an Internet Protocol (IP) packet, and it contains a header and a data section. Headers detail what your message contains, where it's headed, and where it comes from. TTL sits within that header.
Your data likely zooms through several routers and switches as it heads to your destination. At each waypoint, one unit is removed from your TTL.
If you have nothing left within the TTL and your message hasn't arrived, you'll get a "Time Exceeded" message back from ICMP.
Where is TTL used in practice?
We've given a simplified version of TTL within IP packets. Let's push through deeper examples.
In addition to IP packets, you could also use TTL for:
| Use Case | Description | TTL Behavior |
|---|---|---|
| IP Packets | The foundational unit of internet data, each containing a header and data section. | TTL sits within the header and decrements by one at each router hop; if it reaches zero before delivery, an ICMP 'Time Exceeded' message is returned. |
| DNS Records | The Domain Name System (DNS) also uses TTLs. Each time you access a website, your device performs a DNS lookup. | The TTL value determines how long a server can cache information before asking for a new copy. |
| HTTP | Programmers may also use TTLs to outline when records expire. | Values help servers understand when to flush their cache and ask for new information from servers. |
All of these approaches should both improve performance and ensure clean communication paths.
TTL is just one part of ICMP system administrators should know and maintain. Read our guide to find out more about how you can use this protocol to protect critical data.
Frequently asked questions
What happens when a time to live (TTL) reaches zero before a message is delivered?
When a data packet's TTL is fully decremented — meaning it has passed through more routers than its TTL value allowed — the packet is dropped and the sender receives a 'Time Exceeded' message from ICMP, signaling that the destination was not reached.
Why was time to live (TTL) introduced as part of Internet Control Message Protocol (ICMP)?
TTL was defined by the Network Working Group in 1981 as part of the Internet Control Message Protocol to prevent outdated or undeliverable data packets from circulating indefinitely across the internet, keeping network traffic clean and efficient.
How does time to live (TTL) apply to Domain Name System (DNS) records?
In the Domain Name System (DNS), TTL determines how long a server is permitted to cache a DNS record before it must request a fresh copy. This balances performance (fewer lookups) with accuracy (up-to-date records).
What is the relationship between time to live (TTL) and IP packet headers?
TTL is stored directly inside the header of an Internet Protocol (IP) packet. The header also contains information about the packet's origin and destination, and the TTL value decrements by one each time the packet passes through a router or gateway.
How do programmers use time to live (TTL) in Hypertext Transfer Protocol (HTTP) caching?
In Hypertext Transfer Protocol (HTTP), developers use TTL values to define when cached records should expire. Once the TTL elapses, servers discard the cached data and retrieve a fresh version from the origin server.
Is time to live (TTL) only relevant to network administrators?
While system administrators are the primary professionals who configure and maintain TTL settings, TTL affects anyone who accesses the internet — influencing how quickly DNS changes propagate, how fresh cached web content is, and how reliably data packets are delivered.
Internet Control Message Protocol. (September 1981). Network Working Group.