Real-time bidding operates at high queries per second (QPS), resulting in
substantial data transfer between Google and your bidder endpoints. Compressing
bid requests and bid responses might help to reduce network bandwidth usage
and network latency.

Authorized Buyers supports the following compression algorithms for bid
requests and bid responses:

| Compression algorithm | HTTP header value |
|---|---|
| GZIP | `gzip` |
| Zstandard | `zstd` |

## Enable bid request compression

By default, bid requests are uncompressed. To enable compression for incoming
bid requests, use the [Authorized Buyers UI](https://realtimebidding.google.com/)
to select your preferred compression algorithm in your account's RTB settings.
For more information, see [View and edit real-time bidding (RTB) settings](https://support.google.com/authorizedbuyers/answer/10858928).

When you enable bid request compression for your account, Google compresses the
HTTP `POST` request payload containing the `BidRequest` before sending the
payload to your bidder endpoint. Compressed bid requests have a
`Content-Encoding` header set to the compression algorithm used, `gzip` or
`zstd`, which matches the algorithm selected in your RTB settings.

> [!NOTE]
> **Note:** If you enable bid request compression, you must decompress the payload before attempting to parse it as JSON or Protobuf. Attempting to parse compressed bytes results in a deserialization error.

## Compress bid responses

You can compress outgoing `BidResponse` payloads regardless of your
RTB settings. For responses, you can use any compression algorithm listed in the
request's `Accept-Encoding` header. For example, if the request's
`Accept-Encoding` header contains `gzip, zstd`, you can use either GZIP or
Zstandard as your compression algorithm.

You can compress the `BidResponse` sent in your response payload with your
preferred compression algorithm. You must set the `Content-Encoding` header for
your response to match the compression algorithm you used, for example,
`Content-Encoding: gzip` or `Content-Encoding: zstd`.

When returning an empty `HTTP 204` response to indicate that you aren't
placing a bid, don't compress the response. When you send an uncompressed
response, don't set the `Content-Encoding` header.