Flask-Compress
Compress responses in your Flask app with gzip, deflate, brotli or zstandard.
Decision gist · record as of 2026-08-14
Yes, if you need HTTP compression in Flask and cannot use a reverse proxy. The package is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. It supports current Python versions (3.9–3.14) and is straightforward to integrate. Install it when bandwidth reduction or response time matters and you lack infrastructure-level compression.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or newer.
- brotli and brotlicffi are optional runtime dependencies for Brotli compression; backports.zstd is optional for ZStandard compression.
- Low friction install with a pure-Python wheel.
License · maintenance · safety
MIT (permissive) — MIT license (permissive). No restrictions on commercial or private use; attribution required but no copyleft obligations.
last release 2026-03-31 (136 days) · last repo commit 2026-08-04 · 129 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,937,241 downloads/mo, #2,443 on PyPI
Alternatives
Verify before relying
from flask import Flask
from flask_compress import Compress
app = Flask(__name__)
Compress(app)
# Or with deferred initialization:
compress = Compress()
compress.init_app(app)- Performance impact of compression on CPU vs. bandwidth savings for typical workloads.
- Compatibility with async Flask applications or ASGI servers.
- Whether brotli and zstd are optional or required for the package to function.
What it is and what it does
Flask-Compress is a Flask extension that automatically compresses HTTP responses using the client's preferred algorithm (gzip, deflate, brotli, or zstd). It inspects the Accept-Encoding request header, respects quality factors, and attaches the appropriate Content-Encoding headers while compressing response data. The extension works transparently—once initialized with a Flask app, it compresses eligible MIME types (HTML, CSS, JavaScript, JSON, SVG, fonts, and others) on every request without requiring changes to route handlers.
The package supports both global compression and per-view compression via decorators, works with streaming responses, handles ETags for conditional requests, and can integrate with caching layers to serve pre-compressed responses. It's designed as a fallback when a reverse proxy like Nginx cannot handle compression for you, though the documentation notes that server-side compression is the preferred approach.
Use it for
- Compress all HTML, CSS, and JavaScript responses in a Flask app to reduce bandwidth without a reverse proxy.
- Selectively compress specific views using the @compress.compressed() decorator while leaving others uncompressed.
- Serve pre-compressed responses from a cache to reduce CPU load on repeated requests.
- Support modern compression algorithms (brotli, zstd) alongside gzip for clients that request them.
- Reduce payload size for static files served by Flask when Nginx or similar is not available.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need HTTP compression in Flask and cannot use a reverse proxy.
The package is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. It supports current Python versions (3.9–3.14) and is straightforward to integrate. Install it when bandwidth reduction or response time matters and you lack infrastructure-level compression.
Install
flask-compress on PyPI
Before you install
Low friction install with a pure-Python wheel. Maintenance is active—last commit 2026-08-04, repository not archived. Supports Python 3.9 through 3.14 and PyPy.
Requires Python 3.9 or newer. brotli and brotlicffi are optional runtime dependencies for Brotli compression; backports.zstd is optional for ZStandard compression.
License in practice
MIT license (permissive). No restrictions on commercial or private use; attribution required but no copyleft obligations.
Quickstart
from flask import Flask
from flask_compress import Compress
app = Flask(__name__)
Compress(app)
# Or with deferred initialization:
compress = Compress()
compress.init_app(app)
Verify before relying
- Performance impact of compression on CPU vs. bandwidth savings for typical workloads.
- Compatibility with async Flask applications or ASGI servers.
- Whether brotli and zstd are optional or required for the package to function.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesflaskbrotlibrotlicffibackports.zstd |
| Maintenance | Actively maintained 136 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,937,241 / month, #2,443 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules |
Evidence: flask_compress-1.24-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “flask response compression”
- Flask-CompressFlask-Compress automatically compresses Flask application responses…
- Flask-MinifyFlask extension that automatically minifies HTML, JavaScript, CSS,…
- Flask-JSONFlask-JSON adds convenient JSON response generation and error…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also cart · gzip-stream · starlette-cramjam · starlette-compress · brotli-asgi · whitenoise · pgzip · brotlipy · inflate64 · lzstring