Skip to main content

Difference between GET and POST

Short answer

GET retrieves data with parameters in the URL; it can be cached, bookmarked, and is limited in size and less secure. POST sends data in the request body for processing, has no practical size limit, supports binary, and is normally not cached. Use GET for searches and POST for logins or uploads.

What is the difference between GET and POST request?

GET and POST are HTTP request methods. GET asks the server to retrieve a resource; POST sends data to the server to be processed (create or update).

BasisGETPOST
PurposeRetrieve dataSubmit data for processing
Data locationIn the URL query string (?name=ram&age=20)In the HTTP request body
VisibilityVisible in the address bar and historyNot shown in the URL
SecurityLess secure; do not send passwordsMore secure (still needs HTTPS for real protection)
Data sizeLimited by URL length (about 2000 chars)No practical limit
Data typeOnly ASCII textText and binary (file upload, multipart/form-data)
CachingCan be cachedNormally not cached
BookmarkingCan be bookmarkedCannot be bookmarked
IdempotentYes; repeating gives the same resultNo; repeating may create duplicates
Back/refreshHarmlessBrowser warns about resubmission

Example:

<form method="get" action="search.php">...</form>   <!-- search.php?q=web -->
<form method="post" action="login.php">...</form>   <!-- data in body -->

Use GET for searches and filters; use POST for logins, registration forms and file uploads.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Web Technology chapter 2 questions →