In modern in­ter­ac­tive­ly designed websites, the clients - i.e. the browsers - not only retrieve an HTML document from the server, but often also send it the following in­for­ma­tion:

  • The text of a search term that the user has entered into the search field
  • The contents of a completed form
  • The filter selection in a website’s shop
  • A sorted list

For the trans­mis­sion of this kind of in­for­ma­tion to the server, the HTTP protocol provides various request methods. The two most important of these are GET and POST. Although both lead to the same result, they are still fun­da­men­tal­ly different. Read on to find out where the dif­fer­ences lie and when one method may be prefer­able over the other.

Tip

If you want to learn more about request methods in general, read our article about HTTP-Requests.

$1 Domain Names – Grab your favorite one
  • Simple reg­is­tra­tion
  • Premium TLDs at great prices
  • 24/7 personal con­sul­tant included
  • Free privacy pro­tec­tion for eligible domains

GET

With the GET method, the data to be sent to the server is written directly into the URL. In a browser window, this would look like the below:

www.example.com/register.php?firstname=peter&name=miller&age=55&gender=male

All the in­for­ma­tion entered by the user – known as the URL pa­ra­me­ters – is trans­mit­ted as openly as the URL itself. This has ad­van­tages and dis­ad­van­tages.

Ad­van­tages of GET

The URL pa­ra­me­ters can be saved together with the website address. This allows you to bookmark a search query and retrieve it later. If necessary, a page can also be retrieved via the browsing history.

This is useful, for example, when regularly viewing a Google Maps map section, or for saving web pages with certain filter and selection settings.

Dis­ad­van­tages of GET

The main dis­ad­van­tage of the GET method is the lack of data pro­tec­tion. The URL pa­ra­me­ters sent along with the data are not only visible to everyone in the browser address bar, but are also stored un­en­crypt­ed in the browser history, cache, and log file of the server.

A second dis­ad­van­tage is the limited capacity of data length. Depending on the web server and browser, no more than about 2,000 char­ac­ters can be entered in the URL. URL pa­ra­me­ters can also only contain ASCII char­ac­ters (letters, numbers, special char­ac­ters, etc.), but not binary data such as audio files or images.

POST

The POST method writes the URL pa­ra­me­ters in the HTTP request for the server. They are, therefore, not visible to users. The scope of POST requests is unlimited.

Ad­van­tages of POST

When it comes to trans­mit­ting sensitive data to the server - e.g. the reg­is­tra­tion form with user name and password - the POST method offers the necessary privacy. The data is neither cached nor does it appear in the browsing history. Another bonus is how flexible the POST method is. Users can transmit short texts, but also data of any size or type, such as photos or videos.

Dis­ad­van­tages of POST

If a web page is updated using the ‘back’ button, for example, after you’ve used a web form, the form data must be re­sub­mit­ted. You may have pre­vi­ous­ly come across warnings of this kind popping up on the screen. There is a risk that the data is in­ad­ver­tent­ly sent several times, which can trigger unwanted duplicate orders, for example in the case of an order form. However, regularly updated shopping websites using modern pro­gram­ming can prevent this.

Similarly, data trans­mit­ted using the POST method cannot be saved as bookmarks together with the URL.

A com­par­i­son of GET vs. POST

  GET POST
Vis­i­bil­i­ty Visible for the user in the address line Invisible to the user
Bookmarks and browsing history URL pa­ra­me­ters are stored together with the URL URL is saved without URL pa­ra­me­ters
Cache and server log file The URL pa­ra­me­ters are stored un­en­crypt­ed The URL pa­ra­me­ters are not saved au­to­mat­i­cal­ly
Behavior on browser refresh / “Back” button The URL pa­ra­me­ters are not sent again The browser warns that the form data must be resent
Data type Only ASCII char­ac­ters Binary data in addition to ASCII char­ac­ters
Data length Re­strict­ed to maximum length of the URL (2,048 char­ac­ters) Unlimited

When to use POST vs GET

POST is almost always preferred over GET when the user needs to submit data or files to the server, for example when filling out forms or uploading photos.

GET is par­tic­u­lar­ly well-suited for per­son­al­iz­ing websites. The user's search entries, filter settings, and selection settings can be saved as bookmarks along with the URL, so that the next time the user visits the site, it looks exactly the way they want it to look.

Here's a simple rule of thumb to help you remember:

  • GET for settings on a website (filters, sorting, search entries, etc.)
  • POST for the trans­mis­sion of user in­for­ma­tion and data
Go to Main Menu