GET vs POST
What is the difference between GET and POST in a form?
GET adds the fields to the URL as a query string; POST sends them in the request body. That one difference decides everything else: GET results can be bookmarked and shared, while POST keeps data out of the address bar and is the only method that can upload files.
| Question | method="get" | method="post" |
|---|---|---|
| Where the data goes | The URL: /search?q=shoes&size=9 | The request body |
| Visible in | The address bar, history, bookmarks, server logs and analytics | Developer tools only, and the server that receives it |
| Refresh and Back | Repeats the request quietly | The browser asks before sending the data again |
| Bookmark or share the result | Yes | No |
| File uploads | No, only the filename is sent | Yes, with enctype="multipart/form-data" |
| Size | Servers commonly reject request lines over about 8 KB (Apache's default limit is 8,190 bytes) | Set by the server, for example nginx's default 1 MB body limit |
| Use for | Search boxes, filters, sorting, pagination | Contact, sign-up, login, checkout, anything that changes data |
| Default | Yes, when method is missing or invalid | Must be set explicitly |
Neither method encrypts anything. HTTPS encrypts the URL path, query string and body alike; GET's risk is that the URL is stored and shown in more places.
Sources: WHATWG HTML Standard: form submission algorithm · MDN: Sending form data

