The Runtime Theory
easyApplicationFoundations

When Would You Use HTTP GET vs POST?

The difference between GET and POST: idempotency, cacheability, visibility, and payload limits.

TRT practice prompt — not a verified question from a named employer.

The Runtime Theory Team1 min read

When Would You Use HTTP GET vs POST?

The Short Answer

Use GET when you are retrieving data that doesn't change server state. Use POST when you are submitting data that creates or changes server-side state.

Key Differences

DimensionGETPOST
SafetySafe — no side effectsCan cause side effects
IdempotencyIdempotent — same result every timeNot necessarily idempotent
CacheabilityYes — GET responses are cachedNo — responses are not cached by default
VisibilityParameters are visible in the URLParameters are hidden in the body
Length limitsLimited to URL length (~2048 chars)No practical limit
BookmarkingCan be bookmarkedCannot be bookmarked

When to Use GET

  • Loading a page or resource
  • Search queries with parameters in the URL
  • Filtering or paginating lists
  • Any read-only operation

When to Use POST

  • Submitting a form (creating a new user, placing an order)
  • Uploading files
  • Operations that change server state
  • Sending sensitive data (POST body is encrypted in HTTPS, though URL parameters are visible in server logs even with HTTPS)

Follow-up Questions

Is GET always faster than POST?

For practical purposes, yes — GET requests with fewer parameters have shorter URLs and smaller headers. But the difference is negligible compared to network latency and server processing time.

Can GET requests have side effects?

They shouldn't. A GET request should never modify server state. If a GET request changes data (like incrementing a counter), it can cause serious problems when browsers pre-fetch links or when crawlers follow them.

plaintext
 

This answer walks

Practice follow-ups

  1. 01Is GET always faster than POST?
  2. 02Can GET requests have side effects?

One dispatch a week

The trace behind each question, the tradeoff that explains it, and one technical dispatch per week — no noise.

One technical dispatch per week. No noise.

Not started

Sign in to save your learning progress.

Sign in to save