Fundamentals 10 min read

GET vs POST: What’s the Real Difference in HTTP?

This article explains the fundamental differences between HTTP GET and POST methods, covering their request line structure, header and body handling, safety and idempotence properties, caching behavior, length limits, TCP packet usage, and how HTTP distinguishes them for resource management.

Linux Tech Enthusiast
Linux Tech Enthusiast
Linux Tech Enthusiast
GET vs POST: What’s the Real Difference in HTTP?

HTTP Request Message

HTTP request consists of three parts: request line (method, URL, HTTP version), headers (zero or more header fields terminated by CRLF), and optional body. GET requests have no body; POST requests place data in the body.

GET Method Example

GET /search/users?q=JakeWharton HTTP/1.1
Host: api.github.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: _octo=GH1.1.1623908978.1549006668; ...

The request line shows method GET, URL with query parameters, and HTTP/1.1. All following lines are headers; there is no request body.

Parameters are appended to the URL after ? and separated by &.

According to the HTTP specification, GET is used for information retrieval and is defined as safe (no side effects) and idempotent.

Browsers may cache GET responses, returning cached content for identical requests.

URL length limits are imposed by browsers and servers, not by the HTTP protocol.

Typical GET transmission uses a single TCP packet containing headers (and no body).

POST Method Example

POST / HTTP/1.1
Host: www.wrox.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 40
Connection: Keep-Alive

name=Professional%20Ajax&publisher=Wiley

The request line uses POST, the URL is empty, and the form data appears in the body after a blank line.

POST is intended for operations that may modify server resources (e.g., submitting a form, liking a post).

Because it can change server state, POST is neither safe nor idempotent.

The request body has no length restriction defined by the protocol.

Browsers often send two TCP packets: one for headers, then after a 100 Continue response, a second packet for the body. On a good network the overall latency is comparable to GET.

Key Differences

GET places parameters in the URL, is safe and idempotent, cacheable, and typically transmitted in a single TCP packet; URL length is limited by client/server implementations.

POST places parameters in the body, may modify resources, is not safe or idempotent, has no protocol‑defined length limit, and usually requires two TCP packets (headers then body).

Although both methods use the same underlying TCP connection, HTTP distinguishes them to allow separate management of resource retrieval (GET) and resource modification (POST). Swapping the placement of parameters is technically possible but may be rejected or ignored depending on server behavior.

HTTPWeb Protocolrequest methodsGETPOST
Linux Tech Enthusiast
Written by

Linux Tech Enthusiast

Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.