HTTP
What is it?
HTTP is the protocol browsers and servers use to request and send web pages, data, and files.
Explain like I'm 5
Why was it created?
It was created to let computers fetch linked documents across the web in a simple, standard request-and-response way.
Where is it used?
- Loading web pages
- Calling web APIs
- Downloading files and images
- Communication between web services
Why should developers care?
Every website and web API runs on HTTP. Understanding it is fundamental to almost all web work.
How does it work?
A client sends a request with a method (like GET or POST), a URL, and headers. The server replies with a status code, headers, and usually a body. Each request is independent (stateless).
Real-world example
Typing a URL sends a GET request; the server returns status 200 plus the page's HTML, which the browser renders.
Common use cases
- Fetching and submitting web data
- REST and other web APIs
- Serving static assets
- Webhooks between systems
Advantages
- Simple and universal
- Human-readable methods and status codes
- Stateless and cacheable
- Works everywhere
Disadvantages
- Plain HTTP is unencrypted (use HTTPS)
- Stateless design needs extra work for sessions
- Per-request overhead without connection reuse
When should you use it?
For virtually all web communication between clients and servers.
When should you avoid it?
For real-time two-way streams where WebSocket fits better; never use plain HTTP for sensitive data — use HTTPS.
Alternatives
Related terms
Interview questions
Beginner
- What is the difference between GET and POST?
- What does status code 404 mean?
Intermediate
- What does 'stateless' mean for HTTP?
- What are HTTP headers used for?
Senior
- How do HTTP/1.1, HTTP/2, and HTTP/3 differ?
- How does HTTP caching work end to end?
Common misconceptions
- "HTTP and HTTPS are different protocols" — HTTPS is HTTP with encryption (TLS) added.
- "A status 200 means everything is correct" — it means the request succeeded at the HTTP level, not that your app logic did.
Fun facts
- HTTP stands for HyperText Transfer Protocol.
- Status codes are grouped: 2xx success, 3xx redirect, 4xx client error, 5xx server error.
Timeline
- 1991 — Earliest version used on the web
- 2015 — HTTP/2 standardized
Learning resources
Quick summary
HTTP is the request-and-response protocol that powers the web, letting clients fetch and send data from servers.
Cheat sheet
- Request/response protocol of the web
- Methods: GET, POST, PUT, DELETE
- Status codes: 2xx/3xx/4xx/5xx
- Stateless by design