HTTP (HyperText Transfer Protocol) is the foundation of data communication on the World Wide Web (WWW). It is a protocol used for transferring hypertext (web pages, images, videos, and files) between a web client (browser) and a web server.
When you visit a website (e.g., http://example.com
), your browser uses HTTP to communicate with the web server and load the website content.
User enters URL in browser — e.g., http://example.com
.
Browser sends HTTP Request to the web server.
Server processes the request and sends an HTTP Response back (e.g., an HTML page).
Browser displays content to the user.
Example of a GET request:
Method: GET
, POST
, PUT
, DELETE
, etc.
URL/Path: /index.html
(what resource to access).
HTTP Version: HTTP/1.1
, HTTP/2
, etc.
Headers: Extra information (browser, types of data accepted).
Example of a response:
Status Line: HTTP/1.1 200 OK
(200 means success).
Headers: Content-Type, Content-Length, Cookies, etc.
Body: The actual data (HTML page, image, file, etc.).
GET
Retrieve data from server (e.g., webpage).
POST
Send data to server (e.g., form submission).
PUT
Update/replace data on server.
DELETE
Delete resource on server.
HEAD
Retrieve headers only (no body).
OPTIONS
List available methods for resource.
200
OK
Request succeeded.
301
Moved Permanently
Resource has a new permanent URL.
302
Found
Resource temporarily moved.
400
Bad Request
Malformed syntax or invalid request.
401
Unauthorized
Authentication required.
403
Forbidden
Access denied.
404
Not Found
Resource not found.
500
Internal Server Error
Server encountered an error.
503
Service Unavailable
Server temporarily unavailable.
Port
80
443
Encryption
❌ No encryption (data is plain text)
✅ Encrypted via SSL/TLS
Security
Vulnerable to eavesdropping
Protected from man-in-the-middle attacks
URL Prefix
http://
https://
💡 HTTPS is highly recommended for all websites today to ensure security and privacy.
HTTP/1.0
First major version, simple, no persistent connection.
HTTP/1.1
Persistent connections (keep-alive), chunked transfer.
HTTP/2
Binary protocol, faster multiplexing, header compression.
HTTP/3 (QUIC)
Uses UDP, improved speed, reliability, and security.
Full Form
HyperText Transfer Protocol
Layer
Application Layer
Port
80
Secure Version
HTTPS (Port 443, encrypted)
Common Methods
GET, POST, PUT, DELETE
Status Codes
200, 404, 500, etc.
Data Type
Text-based (HTML, JSON, XML, etc.)
Stateless?
Yes
Transport Protocol
TCP
When you open http://example.com
, your browser sends an HTTP GET request to the web server.
The server sends back an HTTP 200 OK response with the webpage content.
Your browser renders and shows the page.