Internet-Draft Zstd Window Size March 2024
Jaju & Handte Expires 5 September 2024 [Page]
Intended Status:
N. Jaju
W. F. P. Handte
Meta Platforms, Inc.

Window Sizing for Zstandard Content Encoding


Deployments of Zstandard, or "zstd", can use different window sizes to limit memory usage during compression and decompression. Some browsers and user agents limit window sizes to mitigate memory usage concerns, causing interoperability issues. This document updates the window size limit in RFC8878 from a recommendation to a requirement in HTTP contexts.

About This Document

This note is to be removed before publishing as an RFC.

The latest revision of this draft can be found at Status information for this document may be found at

Discussion of this document takes place on the HTTPBIS Working Group mailing list (, which is archived at

Source for this draft and an issue tracker can be found at

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 5 September 2024.

Table of Contents

1. Introduction

Zstandard, or "zstd", specified in [RFC8878], is a lossless data compression mechanism similar to gzip. When used with HTTP, the "zstd" Content Encoding token signals to the decoder that the content is Zstandard-compressed.

Deployments of Zstandard can use different window sizes to configure the maximum memory a decoder requires to decompress a frame. Larger window sizes tend to improve the compression ratio, but cause more memory to be used. [RFC8878] provides a recommendation for decoders to support window sizes up to 8 MB, and for encoders to not generate frames requiring window sizes larger than 8 MB. However, it is just a recommendation ([RFC8878], Section

To protect against unreasonable memory usage, some browsers and user agents limit the maximum window size allowed. This causes incompatibilities if the content is compressed with a larger limit, leading to decreased interoperability.

This document updates [RFC8878] to specify a window size limit associated with the "zstd" Content Encoding token.

2. Conventions and Definitions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

3. Window Size

Section of [RFC8878] discusses window sizes in Zstandard. The window size provides guarantees about the minimum memory buffer required to decompress a frame. This information is important for decoders to allocate enough memory.

The minimum window size is 1 KB. The maximum window size is (1<<41) + 7*(1<<38) bytes, which is 3.75 TB.

In general, larger window size values tend to improve the compression ratio, but at the cost of increased memory usage.

To properly decode compressed data, a decoder will need to allocate a buffer of at least the window size bytes.

In order to protect decoders from unreasonable memory requirements, a decoder is allowed to reject a compressed frame that requests a memory size beyond the decoder's authorized range.

To maintain interoperability of Zstandard in HTTP Content Encoding, decoders MUST support window sizes of up to and including 8 MB and encoders MUST NOT generate frames requiring a window size of larger than 8 MB, when using the "zstd" Content Encoding token (see Section 5.1).

Decoders are free to support higher or lower limits, depending on local limitations, if negotiated out-of-band. Many deployments of Zstandard operate in controlled, private environments and can directly communicate with their encoder and decoder to negotiate a higher or lower limit.

4. Security Considerations

This document introduces no new security considerations beyond those discussed in [RFC8878].

5. IANA Considerations

5.1. Content Encoding

This document updates the entry added in [RFC8878] to the "HTTP Content Coding Registry" within the "Hypertext Transfer Protocol (HTTP) Parameters" registry:




A stream of bytes compressed using the Zstandard protocol with a window size of not more than 8 MB.


This document

6. Normative References

Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <>.
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <>.
Collet, Y. and M. Kucherawy, Ed., "Zstandard Compression and the 'application/zstd' Media Type", RFC 8878, DOI 10.17487/RFC8878, , <>.


zstd was developed by Yann Collet.

The authors would like to thank Yann Collet, Klaus Post, Adam Rice, and members of the Web Performance Working Group in the W3C for collaborating on the window size issue and helping to formulate a solution. Also, thank you to Nick Terrell for providing feedback that went into RFC 8478 and RFC 8878.

Authors' Addresses

Nidhi Jaju
Shibuya Stream, 3 Chome-21-3 Shibuya, Shibuya City, Tokyo
W. Felix P. Handte
Meta Platforms, Inc.
380 W 33rd St
New York, NY 10001,
United States of America