How to check if brotli is enabled

Name the encoding yourself: curl -s -H 'accept-encoding: br' -D - -o /dev/null https://example.com/. A content-encoding: br line means brotli is on. A server sends brotli only to a client that lists br, and it answers an encoding it does not have by sending the body raw with no header and no error.

Checker offline. Follow the manual steps below, they give the same answer.

Why check this

Brotli is usually turned on at the CDN, not in the application, so it disappears whenever traffic stops going through the CDN: a staging host pointed at the origin, a new subdomain that nobody added to the zone, a purge that exposes an origin configured years ago. Run this per hostname after any infrastructure change. The failure it prevents is a release where the HTML triples in transferred size on production while every lab test on the CDN-fronted staging URL stays green.

Prerequisites

Steps

  1. Step 1.

    Confirm your curl can speak brotli before trusting any result.

    curl --version | tr ' ' '\n' | grep -E '^(brotli|zstd|libcurl)'
    
    libcurl/8.21.0
    brotli/1.2.0
    zstd/1.5.7
    brotli
    zstd

    No brotli line means the build cannot decode br. Install a build that has it, or read the header only and skip the byte comparison.

  2. Step 2.

    Ask for brotli alone and read the header.

    curl -s -H 'accept-encoding: br' -D - -o /dev/null https://www.cloudflare.com/ | grep -i -E '^HTTP|content-encoding|vary'
    
    HTTP/2 103
    HTTP/2 200
    vary: accept-encoding
    content-encoding: br
  3. Step 3.

    Measure the same document three ways and compare the byte counts.

    for e in identity gzip br; do curl -s -o /dev/null -H "accept-encoding: $e" -w "$e %{size_download}\n" https://www.cloudflare.com/; done
    
    identity 1317143
    gzip 295028
    br 105570

    Brotli is 2.8 times smaller than gzip here and 12.5 times smaller than the raw body.

  4. Step 4.

    Ask for an encoding the server does not have, and watch the silence.

    curl -s -H 'accept-encoding: zstd' -D - -o /dev/null -w 'size=%{size_download}\n' https://www.cloudflare.com/ | grep -i -E '^HTTP|content-encoding|size='
    
    HTTP/2 103
    HTTP/2 200
    size=1317143

    No header, no 406, the full raw body. This is why a brotli check that reads only the status code proves nothing.

  5. Step 5.

    Separate the server rule from the browser rule by asking over plain HTTP.

    curl -s -H 'accept-encoding: br' -D - -o /dev/null -w 'size=%{size_download}\n' http://example.com/ | grep -i -E '^HTTP|Content-Encoding|size='
    
    HTTP/1.1 200 OK
    Content-Encoding: br
    size=318

    The server compressed over an insecure origin. The HTTPS rule is a client rule: Chrome and Firefox list br in Accept-Encoding only on secure origins, so the same page in a browser over http:// arrives gzipped or raw.

How to read the result

| What you see | What it means | What to do | | --- | --- | --- | | content-encoding: br | Brotli is on for this route | Record the byte count as the baseline for the next release. | | content-encoding: gzip after asking for br only | The server ignored your list | Rare and worth a bug. A server may only use an encoding the client offered. | | No header, full-size body | Brotli is not configured here | Check gzip next. A host with neither is the real defect. | | Brotli on HTML, none on JS or CSS | The type list is incomplete | Static assets are where brotli pays most. Extend the list at the CDN. | | Brotli over HTTPS, gzip in a browser over HTTP | Working as designed | Test the scheme users get. An http staging URL understates the saving. |

Common mistakes

Sign: curl says the site has no brotli, and DevTools says it does.Cause: The curl build has no brotli. The Schannel curl 8.13.0 that ships with Windows sends Accept-Encoding: deflate, gzip under --compressed, so the server never offers br and the check reports a false negative. Run curl --version and look for a brotli line.
Sign: A script that runs curl --compressed and greps for gzip reports no compression.Cause: --compressed sends deflate, gzip, br, zstd and lets the server choose. A host with brotli answers br, so the grep for gzip finds nothing on a correctly configured server. Name one encoding per request when the test asserts on a specific one.

Thresholds

105570 bytes brotli against 295028 bytes gzip for the same HTML document, brotli 2.8 times smaller Source: Measured with curl 8.21.0 on 2026-09-11, see the Verified block
Browsers advertise br only on secure origins, so an http:// page never receives brotli Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding

What to check next

FAQ

How to test brotli compression?

Send accept-encoding: br, read content-encoding, then compare %{size_download} against an identity request. Two requests give the answer and the saving. Confirm your curl has brotli first, as in step 1.

How to check if a response is brotli compressed?

Read content-encoding: br on the response. If you saved the body, the first two bytes are not a reliable signal, because brotli has no magic number the way gzip has 1f 8b. Trust the header.

Does brotli require HTTPS?

The server does not require it. http://example.com/ returned Content-Encoding: br when curl asked. Browsers do restrict it: they list br only on secure origins, so testing over http understates what real users receive.

Why does the site show gzip in Chrome and brotli in curl?

Chrome sends its own Accept-Encoding list, and over an insecure origin that list has no br. Your curl command asked for br explicitly. Compare like for like by matching the header the browser sent.

Verified

Verified by Maks Vernycurl 8.21.0

Each output block is what the command above it printed on that date, on the host named in the step. Figures read from a live site move between runs. Compare the shape of the answer rather than the digits, and see the methodology for how a page is re-verified.

basic5 minpublished updated Maks Verny