Compression Streams
Compresses or decompresses data in the page with built-in gzip, deflate or deflate-raw.
In one line
Can squeeze or unpack data in the page with the browser's built in compression
Compresses or decompresses data in the page with built-in gzip, deflate or deflate-raw.
A site can shrink or expand data without a library. It also lets trackers pack fingerprint payloads before sending them out.
What it can and can't do
What the user does: Nothing. It happens when a site's script compresses logs, files or data
It can
- Compress data with gzip or deflate before sending it
- Unpack compressed files in the page
- Shrink payloads, including tracking data, before they go out
It cannot
- See your files unless you chose them
- Send anything by itself, only change data the page already has
- Be turned off from your browser settings
- Do heavy work forever, since large tricks can hit memory limits
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 80 | 2020-02-04 | None |
| Edge | Supported | 80 | 2020-02-07 | None |
| Firefox | Supported | 113 | 2023-05-09 | None |
| Safari | Supported | 16.4 | 2023-03-27 | None |
| Safari on iPhone | Supported | 16.4 | 2023-03-27 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 80 | 2020-02-04 | None |
| Samsung Internet | Supported | 13.0 | 2020-12-02 | None |
How a site asks for it
| API | new CompressionStream('gzip'); new DecompressionStream('deflate') |
| Browser compat keys | api.CompressionStreamapi.DecompressionStream |
| How access is granted | none |
| What the user sees | None (no browser prompt) |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| Activation | none |
| How long it lasts | None |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | No iframe flag; available in workers |
Typical flow
- Create CompressionStream
- Pipe a ReadableStream through it
- Read the compressed stream
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- Formats: gzip, deflate, deflate-raw (brotli not in the spec baseline)
- Streaming only, no password or zip container; browser does not compress files on disk
- DecompressionStream has no output cap; zip bomb risk fills memory
- Support: Chrome 80, Safari 16.4, Firefox 113
The story
What it is
A page can squeeze or unpack data with built in compression, so it sends less over the network.
For you
You never see it. Pages that use it send smaller uploads and open big files faster. It saves time and data.
For makers
Makers drop heavy compression libraries and ship less code. It speeds up uploads, saves and downloads. The same trick can hide the size of data a script sends out, which tracking code can use.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser game compresses save files before uploading them to the cloud, so saves are quick on mobile data. | None named |
| productivity | A web editor compresses documents before sync and saves bandwidth. | Google Docs |
| creative | A web design tool unpacks large project files in the browser. | Figma |
| video | A web video app packs frames or clips before an upload. | None named |
| analytics | An analytics script compresses batches of events before sending them in one request. | None named |
| developer | A web tool lets you drag in a zip or gzip file and view its contents in the page. | None named |
| ads | A tracking script packs a large fingerprint into a small request that is hard to spot. | None named |
Risks
- Hides data size
- Little risk
What the platform says
- MDN Web Docs: Compression Streams API. Gives pages fast built in gzip and deflate, with no extra code to download.
Good uses and abuse
Legitimate uses
- Uploading logs
- In-browser archive tools
- Smaller payloads
Known abuse
- Obfuscated telemetry payloads
- Memory exhaustion with a decompression bomb
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2020-02, Chrome 80: Compression Streams ship
- 2023-05, Firefox 113: Compression Streams ship
Sources
How well checked: Based on official documentation.