Transfer-Encoding Header Explained

What the HTTP Transfer-Encoding header does and when it's used.

Published October 17, 2026

Transfer-Encoding specifies how the body is encoded for transmission between nodes, most commonly chunked, letting servers stream a response of unknown length.

How it works

It is hop-by-hop and not allowed in HTTP/2.

The Transfer-Encoding header is part of the HTTP message and is case-insensitive in name.

In a real exchange

curl -i https://example.com/
Transfer-Encoding: chunked
Where Transfer-Encoding appears.

Practical examples

The header

Transfer-Encoding: chunked

Set or use it in code

res.write('part 1'); res.write('part 2'); res.end()

Inspect it

curl -sI https://example.com | grep -i 'transfer-encoding'

Common mistakes

  • Sending both Content-Length and chunked
  • Buffering chunked streams in proxies
  • Request smuggling via inconsistent parsing

Key takeaways

  • Transfer-Encoding: Transfer-Encoding specifies how the body is encoded for transmission between nodes, most commonly chunked, letting servers stream a response of unknown length.
  • Check it in browser DevTools → Network.
  • Test with curl -I before deploying.

FAQ

When is chunked used?

When the body size is not known upfront.

Is Transfer-Encoding case sensitive?

Header names are case-insensitive; values may not be.

More HTTP articles