Not sure which lesson to do first? Find your level and get a plan →

CS Thinking · Systems, Networks & Impact · Grade 6-8

Protocol

A set of rules that define how data is formatted, transmitted, and received over a network.


Quick Answer

A set of rules that define how data is formatted, transmitted, and received over a network. Both sides must follow the same rules, or the message is meaningless, just as two people need a shared language. Each job has its own protocol: HTTP or HTTPS to fetch web pages, SMTP to send email, DNS to turn a name like example.com into a numeric address, TCP to deliver data completely and in order, and IP to address and route packets. They work in layers, each relying on the one below.

Why This Matters

Protocols are why a phone made in Korea can load a website stored on a server in Brazil running completely different software: both follow the same published rules. Knowing the layers helps you find a fault. If names will not turn into addresses, DNS is the problem; if packets go missing, TCP re-sends them. Without shared protocols, each company's devices could talk only to its own.

Intuitive Explanation

Think about ordering at a café. There is a set of unspoken rules: you queue, the server says 'Next', you say the drink and the size, they repeat it back, you pay, they give you a ticket number. If you sang your order or handed over a drawing, the system would break, even though the café works fine. A network protocol is a written-down set of rules like these: who speaks first, what each message must look like, and what to do when something goes wrong.

Loading one web page uses several protocols stacked in layers. First DNS turns the name schoolnews.org into a numeric address such as 203.0.113.25. Then your browser sends an HTTP request, 'GET /homepage', to that address. Underneath, in most connections, TCP cuts the request into packets, numbers them and re-sends any that are lost. IP puts addresses on each packet so routers can pass it along. Each layer does one job and trusts the layer below to do its own.

A protocol is not a program. HTTP is the rulebook; Chrome, Safari and Firefox are three different programs that all follow it, which is why any of them can open the same site. A protocol is also not the data it carries: a packet is the envelope, while the protocol is the agreement about how envelopes are addressed, numbered and checked.

Think of it like this. A protocol is like the rules of a card game. Two players from different countries can play together if they agree on the rules: what a valid move is, whose turn it is, what happens after a mistake. Change the rules on one side only and the game falls apart. Unlike most games, network protocols are written down exactly, so machines can follow them without arguing.

Core idea. Protocols are layered — higher-level protocols (HTTP) rely on lower-level ones (TCP, IP) to handle the details of delivery.


When to Use

Think about protocols when a question asks how devices agree on a message's format, order or error handling, why devices from different makers can talk, or which rules handle a job: HTTP for web pages, SMTP for email, DNS for names, TCP and IP for delivery. If the question is about the pieces of data themselves, use Packet; if it is about keeping attackers out, use Cybersecurity.

Tip. Ask: Is the question about the agreed rules both sides must follow so their messages are understood?

How to Recognize It

Before you name a protocol, check whether the problem is about rules that two or more devices have to share.

  1. Would the communication break if only one side changed how it formats or answers messages?

    Yes means the problem is about a protocol. If only one program's own steps matter, with no partner, it is an Algorithm.

  2. Are you asked which rules handle a job, like fetching a page, sending email or finding an address?

    Yes: name the protocol, such as HTTP, SMTP or DNS. If it asks about the pieces of data themselves, look at Packet.

  3. Does one set of rules sit on top of another, like a web request riding on a delivery service?

    Yes is protocol layering: each layer uses the one below. If you are only asked which devices are linked, it points to Network.

  4. Is the problem about how one part of a program calls another part of the same program?

    Yes points to Interface, the contract between parts of software. A protocol usually governs messages that travel across a network.

Protocol vs Algorithm vs Interface vs Packet

Protocols, algorithms and interfaces are all written-down rules, so they are easy to swap. The deciding question is who must agree: two devices, one program, or two parts of one program.

Protocol

Meaning
A protocol is a shared rulebook for how devices format, send, receive and answer messages over a network.
Key test
Two separate devices must follow the same rules to understand each other.
Example
SMTP lets an email server in one country hand a message to a server in another.

Algorithm

Meaning
An algorithm is a step-by-step method for solving a problem, which one program can follow on its own.
Key test
No partner is needed; it is one solver's steps.
Example
Checking every name in a list until you find Maya is an algorithm.

Interface

Meaning
An interface is the stated contract for how other parts of a program may use a module.
Key test
It connects parts of software, usually inside one program, not devices over a network.
Example
A sound module offers play(file) and stop(), and other code may only call those two.

Packet

Meaning
A packet is one labeled chunk of data that travels across a network.
Key test
It is the thing being sent, not the rules for sending it.
Example
One packet of a web page holds up to about 1,500 bytes, including its address header.

Formula & Notation

Worked Examples

Example 1 — Match each job to its protocol

Easy

Kim opens a news website and then emails a link to a friend. Five protocols do the work: DNS, HTTP, TCP, IP and SMTP. Match each to its job: (a) find the numeric address for news-site.org; (b) ask the web server for the page; (c) make sure every packet arrives, in order; (d) put addresses on each packet so routers can forward it; (e) send the email to the friend's mail server.
Show the steps and the answer
  1. (a) is DNS.

    Routers deliver to numeric IP addresses, and DNS is the lookup that turns a name into one.

  2. (b) is HTTP and (e) is SMTP.

    Each is an application protocol with its own message format: HTTP requests web pages, SMTP sends mail.

  3. (c) is TCP.

    TCP numbers the packets, checks that they all arrived, and re-sends any that are missing.

  4. (d) is IP.

    IP adds the source and destination addresses that every router reads to forward a packet.

Answer: (a) DNS, (b) HTTP, (c) TCP, (d) IP, (e) SMTP.

Takeaway: Each protocol has one job, and a single click uses several of them stacked together.

Example 2 — Different programs, same protocol

Standard

Lily uses Chrome on a laptop and her grandad uses Safari on an iPad. Both open the same library website and see the same page. Lily says: 'They must be the same program underneath.' Are they? What makes it work?
Show the steps and the answer
  1. Compare the programs: Chrome and Safari are made by different companies, with different code.

    They are different software, so 'the same program' cannot be the explanation.

  2. Find what they share: both send HTTP requests in the format the protocol defines and understand the page the server sends back.

    The protocol is the agreement about the messages, not the program that sends them.

  3. Predict: a new browser written by a student would also show the page if it follows HTTP correctly.

    Any program that follows the rules can join in; that is the whole point of a shared protocol.

Answer: No. They are different programs that follow the same protocol, HTTP, which is why both get the same page.

Takeaway: A protocol is a set of rules, and many different programs can follow it.

Example 3 — Find the mistake: 'the internet uses one protocol'

Application

Omar's laptop can reach a test server by its numeric address, 203.0.113.25, but typing a name like library.org gives 'server not found' for every site. He says: 'The internet runs on one protocol, so if that were broken nothing would work. My internet is fine, so all the websites must be down.' Find the mistake and the likely cause.
Show the steps and the answer
  1. List what works: reaching a server by its number.

    That means IP routing, TCP delivery and HTTP requests are all working.

  2. List what fails: turning a name into a number.

    That step belongs to one protocol, DNS, so a DNS problem breaks names while everything else still works.

  3. Correct the 'one protocol' idea: the internet uses many protocols, each with its own job, working in layers.

    One layer can fail while the others work, which is exactly the pattern Omar sees.

Answer: The mistake is thinking the internet uses one protocol. Many protocols work in layers; here DNS, which turns names into addresses, is failing while IP, TCP and HTTP still work. Fixing or changing his DNS settings should solve it.

Takeaway: When some things work and others fail, ask which protocol handles the step that fails.

Where You'll See It

  • Texting a friend on a different phone brand

    Your iPhone and your friend's Android phone trade messages over the same shared protocols (like TCP/IP and the messaging service's rules), so the message arrives even though the two devices are made by totally different companies.

  • Loading a website

    When you type a web address, your browser speaks HTTP (the rules for asking for a page) on top of TCP/IP (the rules for splitting the page into packets and delivering them in order) — a stack of protocols cooperating for one click.

  • Two kids inventing a secret tapping code

    If both agree that two taps means 'yes' and three taps means 'no,' they can communicate; if one kid changes the rule without telling the other, the taps become meaningless — exactly how a mismatched protocol breaks a network.

Common Mistakes

  1. The slip: A protocol is a piece of software or an app.

    Why it's tempting: We download 'apps that use the internet,' so it feels like the protocol is the program itself.

    Instead: A protocol is the agreed-upon set of rules (the specification); software is one implementation of those rules. Many different programs can all follow the same protocol.

  2. The slip: All internet traffic uses one single protocol.

    Why it's tempting: It all looks like 'the internet,' so it seems like one system with one rulebook.

    Instead: Different jobs use different protocols — HTTP/HTTPS for web pages, SMTP for sending email, FTP for files — each with its own message format and rules.

  3. The slip: Protocols work on their own and don't need each other.

    Why it's tempting: You only see the top-level action (loading a page), so the layers underneath are invisible.

    Instead: Protocols are layered: HTTP usually relies on TCP (HTTP/3 uses QUIC over UDP instead), which relies on IP, which relies on the physical link. Each layer depends on the ones below it to deliver the data.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. Match each job to its protocol: HTTP, SMTP, IP or TCP. (a) sending an email, (b) asking a server for a web page, (c) putting a destination address on each packet, (d) making sure lost packets get resent.

    Hint: Some protocols handle whole messages; others handle delivering packets.

  2. Put these layers in order from top (closest to you) to bottom: IP, the Wi-Fi radio signal, HTTP, TCP. Which layer does HTTP rely on directly?

    Hint: Each layer uses the services of the one just below it.

  3. TCP opens a connection with three messages: SYN, SYN-ACK, ACK. A laptop wants to connect to a server. Who sends each of the three messages?

    Hint: The side that wants to connect speaks first.

  4. A class invents a protocol: every message must be written as TO:name|FROM:name|text. A student sends FROM:Ali|TO:Bea|Lunch? What is wrong, and how should it be written?

    Hint: Compare the order of the parts with the rule.

  5. Why can a phone made by one company load the same web page as a laptop made by another company? Is this best explained by protocols, or by packets?

    Hint: What do the two devices have to agree on to understand each other?

  6. Omar says: "HTTP is a browser. Chrome and Firefox are two different HTTP protocols." What is wrong?

    Hint: Is a rulebook the same thing as a player who follows it?

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Why does a web address start with https?

That beginning names the protocol your browser will use. HTTP is the set of rules for asking a server for a page and getting it back. HTTPS is the same rules with encryption added, so people on the same Wi-Fi cannot read or change what you send. Browsers now warn you when a page uses plain HTTP, especially if it asks for a password.

Who writes the protocols?

Most internet protocols are written by groups of engineers from many companies and universities who meet, argue and agree on a document that anyone can read for free. The Internet Engineering Task Force writes most of these documents, called RFCs, and thousands have been published. Because the rules are public, anyone can build a device or program that follows them, which is why phones, laptops and game consoles from rival companies all work together.

Is HTTP always carried by TCP?

Usually, but not always. For years every web page traveled over TCP, which makes the receiver wait until the pieces arrive in order. HTTP/3, now used by many large websites, runs on a newer protocol called QUIC, which sits on top of UDP and handles lost pieces itself, so one slow piece does not hold up the rest. The layering idea is the same; only the layer in the middle changed.

What happens when two devices know different versions of a protocol?

They usually start by agreeing on a version. When your browser connects to a secure website, it lists the versions and options it understands, and the server picks the newest one they both share. If they have nothing in common, the connection fails with an error. This is why very old devices sometimes cannot open modern secure websites: the site no longer accepts the old rules the device knows.

Learning Path

← Before

PacketNetwork
Protocol

You are here

Next →

Cybersecurity
You should know Packet (the small labelled pieces data travels in) and Network (the devices those pieces travel between). A protocol adds the agreed rules for formatting, addressing, ordering and checking those pieces, arranged in layers such as HTTP on top of TCP on top of IP. Next, Cybersecurity looks at how protocols like HTTPS are used to protect data from attackers.

See Also