What is HTTP (Hypertext Transfer Protocol)?
HTTP (Hypertext Transfer Protocol) lets clients and servers exchange web data. Learn how HTTP works, status codes, HTTP/2 vs HTTP/3, and HTTPS.
The Hypertext Transfer Protocol (HTTP) is an application layer protocol and the foundation of the World Wide Web, used to load web pages through hypertext links. It is a protocol for distributed, collaborative, hypermedia information systems, and it’s what every web developer builds and maintains websites and web applications on top of.
Hypertext is structured text that uses logical links, or hyperlinks, between nodes of content. HTTP is the protocol that exchanges and transfers that hypertext, functioning as a request-response protocol in the client-server computing model: the client sends an HTTP request, and the server, which hosts resources such as HTML files, returns a response containing a status and, usually, the requested content.
In one line: HTTP is the request-response protocol that lets a client, like a browser, ask a server for a resource and receive it back.
How it works: the client sends a request with a method, headers, and an optional body; the server processes it and returns a status code, headers, and usually a body.
Main benefit: one simple, universal standard that lets any client talk to any server, regardless of platform or language.
Best fit: anyone building, debugging, or securing websites, apps, or APIs that move data between a client and a server.
What is an HTTP request?
An HTTP request is how internet clients, such as web browsers, ask for the information they need to load a website. Each HTTP request made across the internet carries a series of encoded data with different types of information.
A typical HTTP request includes:
- HTTP version type
- A URL
- An HTTP method
- HTTP request headers
- An optional HTTP body
What is an HTTP method?
An HTTP method indicates the action the request expects from the server. The two most common methods are GET (requests information) and POST (submits information to the server, such as a form or a password).
Other HTTP methods include:
- PUT – sends data to a server, or creates or updates a resource.
- HEAD – the same as GET, but without the response body.
- DELETE – deletes the specified resource.
- PATCH – applies a partial modification to a resource.
- OPTIONS – describes the communication options available for the target resource.
- CONNECT – starts a two-way connection to the requested resource.
- TRACE – performs a message loop-back test along the path to the target resource.
What is an HTTP response?
An HTTP response is what a client receives back from a server after making a request. A typical HTTP response contains:
- An HTTP status code
- HTTP response headers
- An optional HTTP body
How does HTTP work?
HTTP request-response is the fundamental communication model behind every interaction on the web. Here’s a simplified breakdown of the process:
Request
- You enter a URL in your browser, such as www.example.com.
- Your browser sends an HTTP request to the server hosting that site, including a method (GET to retrieve a page, POST to submit data), headers (information about your browser and accepted languages), a path (such as /about), and an optional body for data like form submissions.
Processing
- The server receives the request and processes it, which may involve querying databases, running scripts, or other actions needed to fulfil it.
Response
- The server sends an HTTP response back, including a status code (such as 200 OK or 404 Not Found), headers (content type, length, caching information), and a body containing the actual content, such as HTML, an image, or JSON.
Rendering
- Your browser receives the response and interprets it. If it’s HTML, the browser renders the page, displaying text, images, and other elements.
Example: think of ordering food at a restaurant. You, the client, give your order (the request) to the waiter. The kitchen, the server, prepares your food (processes the request). The waiter brings you your meal (the response). That’s essentially how HTTP fetches a webpage or any other online resource.
What are HTTP status codes?
Every HTTP response carries a three-digit status code that tells the client what happened to its request. The codes fall into five classes:
- 1xx – Informational. The request was received and processing continues.
- 2xx – Success. The request was received, understood, and accepted.
- 3xx – Redirection. Further action is needed to complete the request, usually at a different URL.
- 4xx – Client error. The request contains bad syntax or can’t be fulfilled, such as a missing page.
- 5xx – Server error. The server failed to fulfil a valid request.
Some of the codes you’ll see most often:
| Code | Status | What it means |
|---|---|---|
| 200 | OK | The request succeeded and the response body contains the result. |
| 301 | Moved Permanently | The resource now lives at a new URL, and future requests should use it. |
| 400 | Bad Request | The server couldn’t understand the request due to invalid syntax or parameters. |
| 401 | Unauthorized | The request lacks valid authentication credentials. |
| 403 | Forbidden | The server understood the request but refuses to authorize it. |
| 404 | Not Found | The server can’t find the requested resource. |
| 500 | Internal Server Error | The server encountered an unexpected condition and couldn’t fulfil the request. |
| 503 | Service Unavailable | The server is temporarily unable to handle the request, often due to overload or maintenance. |
What is HTTPS?
HTTPS (Hypertext Transfer Protocol Secure) is HTTP layered on top of the TLS/SSL protocol, adding encryption, authentication, and data integrity to standard HTTP communication. In practice, HTTPS encrypts the request and response so a third party intercepting the traffic can’t read or tamper with it.
HTTPS is no longer optional: browsers flag plain HTTP sites as “not secure”, search engines favor HTTPS in rankings, and any page that handles logins, payments, or personal data needs it by default. The same logic applies to APIs and integrations, where HTTPS keeps customer data encrypted as it moves between systems.
HTTP/1.1 vs HTTP/2 vs HTTP/3: what is the difference?
HTTP itself has evolved to move data faster and more reliably. The three versions in active use today differ mainly in how they handle connections:
| Version | Connection model | Key advantage |
|---|---|---|
| HTTP/1.1 | One request per connection, with keep-alive to reuse it. | Simple and universally supported, but requests can queue behind each other. |
| HTTP/2 | Multiplexes many requests over a single TCP connection. | Loads multiple resources in parallel, cutting page load time. |
| HTTP/3 | Runs over QUIC on UDP instead of TCP. | Faster connection setup and better performance on unreliable or mobile networks. |
Most modern browsers and APIs now default to HTTP/2 or HTTP/3. This matters for any HTTP-based integration, including communication APIs, where a faster protocol version can reduce latency on high-throughput traffic.
What are hypertext documents?
Hypertext documents are the building blocks of the web: text files containing hyperlinks to other documents, letting users navigate between them non-linearly.
HTML (Hypertext Markup Language) is the standard language used to create hypertext documents. It uses tags to define a document’s structure and content, including headings, paragraphs, links, and images. HTTP is the application protocol that enables browsers to request and receive those hypertext documents from web servers, defining how they’re transferred over the internet.
FAQs
HTTP status codes are three-digit codes a server returns with every response to say whether a request succeeded, needs redirecting, or failed. They’re grouped into five classes: 1xx informational, 2xx success, 3xx redirection, 4xx client error, and 5xx server error.
HTTP/1.1 sends one request per connection and can queue behind slow requests. HTTP/2 multiplexes many requests over a single connection, so resources load in parallel and pages typically load faster.
Cookies aren’t part of the core HTTP spec, but servers set them using the Set-Cookie response header. Browsers then attach them automatically to every subsequent request to that domain via the cookie request header, which is how logins and sessions persist between page loads.
Open your browser’s developer tools (F12) and go to the Network tab, then reload the page. Every HTTP request and response, including headers, status codes, and body, is listed there for inspection.
HTTP caching stores a copy of a response, usually controlled by the Cache-Control and ETag headers, so a browser or proxy can reuse it instead of requesting the same resource again. This cuts load time and reduces server traffic.