Networking

What Is a Network Protocol? Definition and Examples

A network protocol is a set of agreed rules that tells two devices how to format, send, receive and acknowledge data so they can understand each other. Examples are IP for addressing and routing, TCP for reliable delivery, and HTTP for web requests.

Think of a protocol as the grammar and etiquette of a conversation between computers. It fixes what a message looks like, what order the steps happen in, and what each side does when something goes wrong. Without that shared agreement, bytes arriving over a cable or radio link are just bytes.

What a protocol actually specifies

Every network protocol answers some mix of these questions:

  • Message format. Which fields come first, how long each one is, and how the receiver can tell where a message ends.
  • Addressing. How the sender names the destination, for example an IP address or a port number.
  • Sequence. Who speaks first and what reply is expected, such as a handshake before data flows.
  • Error handling. What to do when data is lost, duplicated, reordered or malformed.

Not every protocol answers all four. Some are deliberately minimal, and leave error handling to another protocol above or below them.

Why protocols come in layers

No single protocol does everything. Instead, the Internet uses a stack, and each layer relies on the one below it. RFC 1122, which defines the requirements for Internet hosts, describes four layers, from top to bottom:

LayerJobExample protocols
ApplicationWhat the program wants to sayHTTP, DNS, DHCP
TransportEnd-to-end delivery between programsTCP, UDP
InternetMoving packets from host to host across networksIP, ICMP
LinkMoving frames across one directly connected networkEthernet, Wi-Fi

The benefit is that layers can change independently. A web browser speaks HTTP the same way whether the packets travel over Wi-Fi or an Ethernet cable, because the link layer hides that difference. You may also see the seven-layer OSI model in textbooks. RFC 1122 notes that the Internet's application layer combines the OSI model's presentation and application layers, which is why the Internet stack is usually drawn with four layers.

Four protocols you meet every day

IP: addressing and routing

The Internet Protocol, defined in RFC 791, provides for transmitting blocks of data called datagrams from sources to destinations, where sources and destinations are hosts identified by fixed-length addresses. It also handles fragmentation and reassembly of long datagrams when a network can only carry small packets. IP does not promise delivery. RFC 791 states that it has no acknowledgments, either end to end or hop by hop, and no retransmissions. Anything that needs reliability has to add it on top. See public vs private IP addresses for how those addresses are used in practice.

TCP: reliable delivery

The Transmission Control Protocol sits on top of IP. RFC 9293 says TCP provides a reliable, in-order, byte-stream service to applications, and that each TCP segment is sent as an IP datagram. Before data moves, the two ends set up a connection with a procedure called the three-way handshake, which uses SYN and ACK control bits. The reliability comes from acknowledgments and retransmission, which are exactly the things IP leaves out. RFC 9293 was published in August 2022 and obsoletes RFC 793, the original TCP specification.

UDP: delivery without the extras

The User Datagram Protocol is the other common transport protocol. RFC 1122 describes UDP as connectionless, in contrast to TCP's connection-oriented delivery. It sends independent messages with no handshake. That makes it lighter, and it is why applications that tolerate some loss, or that implement their own recovery, often choose it. The full comparison is in TCP vs UDP.

HTTP: the web's language

HTTP is an application-level protocol. RFC 9110 describes it as stateless, meaning each request is self-contained and the server is not required to remember earlier ones. It says each message is either a request or a response. When a URL does not name a port, the default TCP port is 80 for http and 443 for https. The three-digit result codes in responses are covered in HTTP status codes explained.

What a protocol message looks like

HTTP/1.1 is a text protocol, so you can read it. Example request:

GET /index.html HTTP/1.1
Host: example.com
Accept: text/html

The first line holds the method, the path and the protocol version. The following lines are header fields, each a name and a value. A server that understands the protocol replies with a status line and its own headers, then the content. This is example output, trimmed for length:

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1256

Both sides know that a blank line ends the headers, and that Content-Length says how many bytes of body follow. That shared knowledge is the protocol. Remove it and the same bytes mean nothing.

Lower layers are binary rather than text. A TCP or IP header is a fixed arrangement of fields measured in bits and bytes, which is why you need a packet analyser, not a text editor, to read them.

How the layers work together

When your browser loads a page, several protocols cooperate, each doing its own job. A name lookup (see how DNS works) turns a host name into an IP address. A TCP connection to port 443 is opened. HTTP messages travel inside that connection. Each TCP segment is carried in an IP datagram, and each datagram is carried in a link-layer frame across your local network. Your device likely got its own IP address in the first place from a protocol too, covered in what is DHCP.

Each layer wraps the data from the layer above with its own header. This wrapping is called encapsulation. The receiving device removes the headers in reverse order, until the application gets the original message.

Protocols, ports and standards

Two terms get confused with protocols. A port number is only a label that tells the operating system which program should receive incoming data; it does not describe the rules of the conversation. HTTP is the protocol and 80 is a conventional port for it. Read what is a port number for details.

A standard is the written specification. Most Internet protocols are published as RFCs by the RFC Editor, which is why this article cites them. Because the specifications are public, software from different vendors can interoperate. Your browser can talk to a web server written by someone else, on an operating system you have never used, because both follow RFC 9110.

Common questions about the term

Protocols are not limited to the Internet. A USB cable, a Bluetooth headset and a serial port each use a protocol of their own. The word describes any agreed set of rules for communication, and "network protocol" simply means the ones used between networked devices.

A protocol is also not a program. It is a description. A program that implements the description, such as the TCP code inside your operating system or the HTTP code inside a browser, is called an implementation. Two implementations can differ in speed or features and still be correct, as long as they follow the rules on the wire.

Frequently asked questions

What is the difference between a protocol and a standard?
A protocol is the set of rules two systems follow when they communicate. A standard is a published document that defines those rules so independent implementations can interoperate. Many Internet protocols are defined in RFCs, which are the standards documents, but a protocol can also exist without a formal standard, for example a private protocol between a company's own apps.
Is a port the same thing as a protocol?
No. A protocol defines the rules for a conversation. A port number is a label that tells the receiving computer which program should get the data. HTTP is a protocol; port 80 is the default TCP port that plain HTTP uses, and port 443 is the default for HTTP over TLS.
How many network protocols are there?
There is no single fixed count. The Internet alone uses a large and growing set of them, each covering a narrow job such as addressing, reliable delivery, name lookup or web requests. In practice you meet only a handful regularly: IP, TCP, UDP, HTTP, DNS, DHCP and TLS.
Do both devices need to use the same protocol?
Yes, for a given conversation. Both ends must agree on the message formats and the order of steps. A browser that sends an HTTP request to a server that only speaks another protocol on that port will get no useful answer, or the connection will be closed.

Sources