What's the difference between HTTP GET and POST methods? When to use methods GET and POST in HTML forms.


HTTP request methods are defined in RFC2616 Section 9 Method Definitions. These methods are also known as verbs as they indicate the desired action to be performed on an identified resource.

Understanding the basics in simple terms

From a practical point of view, these are the most simple (not so accurate) definitions and differences.

GET method

$_GET is an array of variables passed to the current script via the URL parameters. – W3schools


POST method

$_POST is an array of variables passed to the current script via the HTTP POST method. – W3schools

POST /data/form HTTP/1.1
Host: example.com

When to use GET vs POST methods

In most cases:

GET should be used to retrieve data from a specified resource and sending non-sensitive data.

POST is the preferred way for sending form data.

Can be cached
Remain in the browser history
Can be bookmarked
Data visible in URL
Used with sensitive data
Data length restrictions
ASCII data type allowed
Binary data type allowed
Content-Type application/x-www-form-urlencoded
Content-Type multipart/form-data


Example: a search page should use GET, while a form that changes your password should use POST.


Marcelo Canina
I'm Marcelo Canina, a developer from Uruguay. I build websites and web-based applications from the ground up and share what I learn here.