Nagle’s algorithm

Definition of Nagle’s Algorithm in Network Encyclopedia.

What is Nagle’s algorithm?

Nagle’s algorithm is an algorithm used in implementations of TCP/IP that controls traffic congestion on a network. Nagle’s algorithm limits transmission of small datagrams and controls the size of the Transmission Control Protocol (TCP) sending window.

The algorithm increases the efficiency of routers by reducing the latency of the routing process. It is also an important mechanism for enabling large internetworks such as the Internet to handle TCP/IP applications (such as Telnet applications) that communicate using large numbers of small Internet Protocol (IP) packets.

Nagle's Algorithm
Nagle’s Algorithm

For example, consider a Telnet client communicating with a Telnet server. When a user types a single character in the Telnet client window, TCP packages the character and sends it to the server as a very small packet. It would be highly inefficient if each character typed into a Telnet window were sent as an individual packet. In fact, when the user types the next character, one of two things can happen:

  • If an acknowledgment has been received for the first packet sent, TCP packages the second character into a second small packet and sends it immediately to prevent delay.
  • If an acknowledgment has not been received for the first packet, TCP buffers the second character, then the third, and so on until the acknowledgment is received or the buffer has reached a certain size, triggering TCP to package the buffered characters and send them. This is a result of Nagle’s algorithm being implemented on the client TCP/IP protocol stack. The process of buffering the TCP send buffer is sometimes called “nagling.”

Another part of Nagle’s algorithm addresses the problem of a network system getting bogged down when a large datagram is sent over and over again because it takes too long to fill a sending window (the receiving buffer) with the data from the datagram.

According to the algorithm, when a client receives a message that datagrams are being dropped because of congestion at a particular host, the client responds by temporarily acting as if the host’s window size has been reduced. This “throttles back” the amount of information sent to the host and enables the host to catch up.


Nagle’s algorithm is defined in Request for Comments (RFC) 896. It is implemented in the TCP/IP protocol stack of the Microsoft Windows NT and Windows 2000 operating systems. Proposals have been put forth for improving this algorithm because it does not produce optimal results with certain kinds of TCP/IP interactions, such as those based on HTTP 1.1.


Articles posted after being checked by editors.

Recent Posts