HTTP Explained: How the Web Asks and Answers

HTTP explained in plain terms means the set of rules that lets your browser ask a server for something, a page, a picture, a video, and lets the server answer in a way the browser understands. The central question is how a click becomes a page, and the short answer is a short conversation: the browser sends a request, the server sends a response, and the page you see is built from what comes back.

Every page you have ever visited arrived this way. When you type an address or tap a link, your browser does not fetch the page by magic; it writes a small, structured message, sends it across the internet to the computer that holds the page, and waits for a reply. That message and its reply follow HTTP, the Hypertext Transfer Protocol, and without it the web would be a collection of computers with no common language.

HTTP was created by Tim Berners-Lee at CERN in the early 1990s, alongside the first web browser and server, as a simple way to share documents between researchers. The first version was little more than a request for a file and the file itself. It has grown since then, through versions 1.1, 2, and 3, but the idea has never changed: a client asks, a server answers, and the conversation is short and stateless.

Key takeaways

  • HTTP is the protocol browsers and servers use to exchange web pages and files.
  • A browser sends a request, and the server answers with a status code and content.
  • Requests use methods such as GET to fetch and POST to send data.
  • HTTP is stateless, so each request stands alone unless cookies or sessions add memory.
  • HTTPS is HTTP carried over an encrypted connection, protecting the conversation from eavesdroppers.

What HTTP is

HTTP is an application-layer protocol, which means it sits at the top of the stack of rules that move data across the internet, dealing in documents and messages rather than wires and packets. It defines the shape of a request, the shape of a response, and the meanings of the codes a server can return. Both sides of the conversation know the format in advance, so any browser can talk to any server.

A request has three parts: a method, a target, and headers. The method says what the browser wants to do, usually GET, meaning fetch this, or POST, meaning take this data I am sending. The target is the address of the thing wanted, the path of the page or file. The headers carry extra information, such as which browser is asking, what kinds of content it accepts, and any cookies it holds for the site.

A response has a status line, headers, and a body. The status line carries a three-digit code that summarises the outcome, such as 200 for success, 404 for not found, or 500 for a server error. The headers describe what follows, including the type of content and its length, and the body carries the actual content: the HTML of the page, a picture, a style sheet, or a piece of data. Our guide to DNS explains the step that happens just before any of this, turning the address you typed into the number of the server your browser must contact.

The most important property of HTTP is that it is stateless. The server remembers nothing about you between requests. Each request arrives as if it were the first, and the server answers it on its own merits. This makes servers simple and easy to scale, since any of a thousand identical servers can answer any request, but it means that anything that must persist, such as a login or a shopping basket, has to be carried in the request itself, usually as a cookie or a token.

How HTTP works

It starts with an address. You type a web address or tap a link, and the browser takes the address apart: the scheme, http or https, the host name, and the path to the page. It looks up the host name, opens a connection to the server, and sends the request, a few lines of plain text.

The server receives the request and decides what to do with it. For a simple page, it may read a file from disk and send it back. For a page built on the fly, it hands the request to an application, which builds the answer from a database and templates, and returns the result. The server then wraps that result in a response, stamps it with a status code and headers, and sends it down the connection.

The browser reads the response and builds the page. The first thing it receives is the HTML, which lists the other things the page needs: style sheets, scripts, and images. The browser then sends further requests for each of those, dozens of them for a typical page, and assembles everything into what you see on screen. A single page load is therefore not one conversation but many, one per resource.

Modern versions of HTTP speed this up. HTTP/2 lets many requests share one connection and compresses the headers to cut overhead. HTTP/3 goes further, running over a newer transport that recovers faster from lost packets and connects more quickly, which matters most on mobile networks. The request and response idea stays the same; only the plumbing gets faster.

Caching sits on top of all of this. Responses can be marked reusable for a time, so a repeated visit need not fetch everything again; a browser that has the site’s logo cached simply does not ask for it. That is why the second visit to a site feels faster than the first, and why a stale cache can occasionally show yesterday’s version of a page. Our guide to SSL certificates explains the certificates that make the encrypted version of this conversation possible, and how your browser checks that it is talking to the real site.

A photograph of a dark office at night with a laptop showing a glowing green web browser requesting a page from a server
Every page load is a short conversation: the browser asks, the server answers, and the page is assembled from the replies.

Comparing HTTP with HTTPS

Aspect HTTP HTTPS
Encryption None, messages travel as plain text Encrypted, unreadable to eavesdroppers
Trust No proof of who the server is Certificate proves the server’s identity
Port Usually port 80 Usually port 443
Speed Slightly less overhead Small cost for encryption, faster in practice
Use today Rare, mostly local testing The default for the whole web

Where HTTP is used

Everywhere a browser meets a server, which is to say everywhere on the web. Loading a news article, checking a bank balance, watching a video, or buying a train ticket all begin as HTTP requests and end as HTTP responses. It is the background hum of the entire web, invisible precisely because it works so reliably.

Beyond browsers, HTTP carries the traffic of application programming interfaces. When a phone app shows the weather, fetches your messages, or loads a feed, it is usually making HTTP requests to a server, asking for data in a structured format and receiving it in reply. Our guide to REST APIs explains how those requests are organised, and why so many apps speak HTTP with no browser involved.

It is also the transport for streaming and downloads. A video player asks for the next few seconds of video with an HTTP request, a podcast app downloads an episode the same way, and a software update arrives as HTTP responses. The protocol does not care what the content is; it only carries it.

Inside companies, HTTP runs the dashboards and internal tools that never face the public internet. Microservices, small programs that each do one job, talk to each other over HTTP, using the same request and response pattern that serves a web page.

Strengths and limits

Its greatest strength is simplicity. HTTP is a readable, text-based protocol with a small set of methods and a clear request and response shape, which makes it easy to learn, easy to debug, and easy to build tools for.

It is also flexible and universal. Because it only defines how messages are shaped, not what they carry, it has survived three decades of change, from plain documents to video, from desktop browsers to phones and watches, without being replaced. Everything on the web speaks it, so everything can talk to everything else.

Its limits start with statelessness. Every request must carry its own context, which adds overhead and makes real-time, two-way communication awkward. A chat app or a live dashboard cannot rely on request and response alone; it needs extra machinery, such as long-lived connections or polling, to keep information flowing.

Plain HTTP is also insecure by design, since messages travel as readable text that anyone on the path can see or alter. That is why HTTPS has replaced it almost everywhere, and why browsers now warn about sites that still use plain HTTP. The protocol itself was never built to protect secrets; encryption was added around it, not inside it.

HTTP checklist

  • Use HTTPS everywhere, never plain HTTP, for anything users can reach.
  • Return the right status code: 200 for success, 404 for missing, 500 for server errors.
  • Keep responses cacheable where content rarely changes, and set clear expiry times.
  • Use GET for fetching and POST for sending data, never the other way round.
  • Keep URLs short, readable, and stable, since people and search engines remember them.
  • Compress responses to cut load times on slow connections.
  • Set security headers that limit what a page can load and where it can send data.
  • Log requests and errors, so you can see what is failing and how often.
  • Test with a real browser and a slow connection, not only on a fast office network.

Frequently asked questions

What does HTTP stand for?

HTTP stands for Hypertext Transfer Protocol. It is the set of rules that governs how browsers ask servers for web pages and how servers answer, and it has underpinned the web since Tim Berners-Lee created it in the early 1990s.

What is the difference between HTTP and HTTPS?

HTTPS is HTTP carried over an encrypted connection, using TLS. The messages are the same, but HTTPS scrambles them so that nobody between your browser and the server can read or alter them, and it proves the server is who it claims to be.

What is an HTTP request?

An HTTP request is a message a browser or app sends to a server, asking for something. It contains a method, such as GET or POST, the address of the resource wanted, and headers carrying extra details such as the browser type and any cookies.

What is an HTTP status code?

A status code is the three-digit number at the start of a server’s response, summarising the outcome. Common ones are 200 for success, 301 for a permanent redirect, 404 for not found, and 500 for a server error.

Is HTTP stateless?

Yes. The server remembers nothing about you between requests, so each request must carry any information the server needs, usually in a cookie or a token. This keeps servers simple and scalable, at the cost of extra work for anything that must persist.

What is HTTP/3?

HTTP/3 is the newest version of the protocol, running over a transport called QUIC instead of TCP. It establishes connections faster and recovers more gracefully from lost packets, which makes pages load noticeably quicker on mobile networks.

The bottom line

HTTP explained in one line is this: a simple, stateless conversation in which a browser asks for something and a server answers, repeated dozens of times to build every page you see.

It is old, simple, and still the foundation of the web. Learn its methods, its status codes, and the difference HTTPS makes, and you will understand what is happening every time a page loads, including when it goes wrong.

This article is general information about how HTTP works, not advice about which technology suits a particular project.

Latest articles

Scroll to Top