REST vs GraphQL: measuring the payload difference
The REST versus GraphQL argument is usually settled on developer experience. The bill is settled on bytes. Both designs can be cheaper depending on how the client asks for data, and the difference is measurable before a single line of schema is written.
Where the bytes come from
A REST response carries whatever the endpoint decides to return, so a mobile screen that needs three fields often receives thirty. GraphQL returns exactly the selected fields, but every request carries the query text, and a deeply nested query can return more than the REST endpoint it replaces. The comparison therefore depends on three numbers per user action: how many requests, how large each response is, and how much of it the client uses.
| Design | Requests per action | Response size | Typical effect |
|---|---|---|---|
| REST, coarse | 3 | 24 KB each | 72 KB, most fields unused |
| REST, tailored | 3 | 8 KB each | 24 KB, more endpoints to maintain |
| GraphQL, single query | 1 | 20 KB | 20 KB plus 0.5 KB query text |
| GraphQL, over-nested | 1 | 60 KB | Worse than the REST version |
The comparison that matters
Fix the unit of comparison at one user action, not one HTTP request. Count every request the action triggers, add header overhead of roughly one kilobyte per request and response pair, apply your compression ratio, then multiply by monthly actions. That is the only figure that predicts the invoice.
When REST wins on bytes
REST is cheaper when the client needs most of the resource, when responses cache well at the CDN, and when the same URL is requested repeatedly by many users. A public list endpoint with a one-hour cache can serve thousands of reads from a single origin response, a pattern that is awkward to reproduce with per-user GraphQL queries.
When GraphQL wins on bytes
GraphQL is cheaper when screens need small slices of many resources, when the alternative is a chain of waterfall requests, and when mobile clients pay for every kilobyte. The saving comes from removing over-fetch and from collapsing round trips, not from the protocol itself.
Measuring instead of arguing
Pick your three most common user actions, log the actual request and response sizes for a week, and compare them against the monthly call count. The calculator on this site does the arithmetic with your numbers and shows both designs side by side. If the saving is under ten percent, choose on maintainability, because the byte argument will not pay for the migration.
A measurement plan you can run this week
Instrument one endpoint group, record the request and response sizes at the edge, and keep the numbers for a week. Include the headers, because at high call volumes they are a real fraction of the bill. Then compute the monthly total for the current design and for the candidate, using your own calls-per-action figure rather than a vendor benchmark.
Add one column for cache hit rate. A design that looks heavier per call can still be cheaper overall if its URLs cache well at the edge, and a design that looks lighter can be expensive if every response is unique. The comparison is only meaningful when all three numbers — size, calls, cache — come from the same workload.
- Record compressed bytes at the CDN, not at the application.
- Count requests per user action, including the ones triggered by the UI.
- Include a column for the engineering cost of each endpoint you must maintain.
Open the calculators and put these numbers to work on your own API.
Open API BenchFrequently asked questions
Does GraphQL always reduce payload size?
No. It reduces over-fetching for small screens but adds query text to every request and can over-fetch through nested selections. Without persisted queries and depth limits it can easily transfer more than a tailored REST endpoint.
How large is the header overhead?
For a typical authenticated JSON request and response, plan on roughly one kilobyte combined for the request line, headers and response headers. It is small per call but significant at a hundred million calls per month.
Should I count compressed or uncompressed bytes?
Count compressed bytes for the bill, because that is what crosses the network, and keep the uncompressed figure for memory and parsing costs on the client.
Sources
Related guides
- Capacity planning with Little's LawTurn a target request rate and three latency percentiles into the concurrency, threads and instances an API actually needs.
- Tail latency: why P95 and P99 decide your timeoutAverages hide the requests that hurt. How to read percentiles, calculate what they cost, and set timeouts that do not cut off healthy traffic.
- Retry storms: how a 1% error becomes 300% loadRetries are new traffic. Calculate the amplification, recognise the cliff, and design retry budgets that fail politely.
- API egress cost: the arithmetic behind the invoiceHow call volume, payload size, compression and cache hit rate become a monthly transfer bill, and where the cheapest savings are.