Transfer-Encoding Header

Table of Content

The Transfer-Encoding header is used in HTTP (Hypertext Transfer Protocol) to specify the type of transformation that has been applied to the body of an entity, allowing for the payload to be compressed or otherwise processed to make it more secure or efficient for network transmission. Its main purpose is to ensure that the entity is properly received and understood by the receiving entity.


Transfer-Encoding: chunked
Transfer-Encoding: compress
Transfer-Encoding: deflate
Transfer-Encoding: gzip
Transfer-Encoding: identity


  1. Chunked: Sends the body of the message in chunks that are of a defined size.
  2. Compress: Uses the Lempel-Ziv-Welch (LZW) algorithm to compress the body of the message.
  3. Deflate: Compresses the message body using the zlib structure.
  4. Gzip: Uses the GNU zip (gzip) algorithm to compress the message body.
  5. Identity: Applies no transformation whatsoever, with the message body being sent as is.


Using Transfer-Encoding in Node.js:

var http = require('http');
var server = http.createServer(function(req, res) {
    res.setHeader('Transfer-Encoding', 'chunked');
    res.end('Hello World');

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify Transfer-Encoding header

ModHeader is an extension for Google Chrome that allows you to modify headers on the fly to test and debug your application. To modify the Transfer-Encoding header using ModHeader, follow these steps:

  1. Install the ModHeader extension from the Chrome Web Store.
  2. Click on the ModHeader icon next to the address bar to open the extension.
  3. In the "Response headers" section, enter "Transfer-Encoding" as the header name.
  4. In the adjacent input box, enter the type of transfer encoding you want to apply, like "chunked".
  5. Now, all your HTTP responses will have the Transfer-Encoding set as per your input.

Modifying the Transfer-Encoding header can be useful to check how your application behaves with different types of encodings or to bypass certain restrictions imposed by servers. Always ensure to use this responsibly and within allowed boundaries.