{"id":857,"date":"2026-10-11T22:37:51","date_gmt":"2026-10-11T22:37:51","guid":{"rendered":"https:\/\/windows-vps.org\/blog\/?p=857"},"modified":"2026-10-11T22:37:51","modified_gmt":"2026-10-11T22:37:51","slug":"iis-compression-brotli-vs-gzip-static-vs-dynamic","status":"publish","type":"post","link":"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/","title":{"rendered":"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Compression is one of the cheapest performance wins on an IIS-hosted site, and it is also one of the most commonly left on the default. Windows Server ships IIS with static and dynamic compression modules that support gzip out of the box, while Brotli only arrives through cross-platform .NET hosting or third-party modules. Choosing between gzip and Brotli, and between static and dynamic compression, changes payload size by 15\u201325% on typical text assets and CPU load by a similar magnitude in the other direction. This article covers how to enable both, when each makes sense, and how to verify the win.<\/p>\n<h2 class=\"wp-block-heading\">Static vs Dynamic Compression in IIS<\/h2>\n<p class=\"wp-block-paragraph\">The two modules are not interchangeable and they do not share a cache.<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Static compression:<\/strong> Compresses files on disk once and caches the result under <code>%SystemDrive%\\inetpub\\temp\\IIS Temporary Compressed Files<\/code>. Cheap at request time because the work is already done. Ideal for CSS, JS, HTML, and JSON that does not change per request.<\/li>\n<li><strong>Dynamic compression:<\/strong> Compresses each response in memory as it is generated. Hits the CPU on every request but works for anything \u2014 including API responses that never exist as a file. More expensive, so keep it scoped to the MIME types that benefit.<\/li>\n<\/ul>\n<p class=\"wp-block-paragraph\">The classic mistake is enabling dynamic compression for <code>image\/*<\/code> and <code>video\/*<\/code>. Already-compressed formats get bigger after gzip and you pay CPU for the privilege. Restrict dynamic compression to text and JSON.<\/p>\n<h2 class=\"wp-block-heading\">Enabling gzip Compression<\/h2>\n<p class=\"wp-block-paragraph\">Install the modules and configure them from an elevated PowerShell session:<\/p>\n<pre class=\"wp-block-code\"><code>Install-WindowsFeature -Name Web-Dyn-Compression, Web-Stat-Compression\n\nImport-Module WebAdministration\n# Dynamic: only text-like types\nSet-WebConfigurationProperty -PSPath 'IIS:\\' `\n  -Filter \"system.webServer\/httpCompression\" `\n  -Name \"dynamicTypes\" -Value @{mimeType='application\/json'}\nAdd-WebConfigurationProperty -PSPath 'IIS:\\' `\n  -Filter \"system.webServer\/httpCompression\/dynamicTypes\" `\n  -Name \".\" -Value @{mimeType='text\/html'}<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Also set <code>dynamicCompressionLevel<\/code> (1\u20139, default 0 which means no dynamic compression unless a level is set) and the static compression equivalents. Level 4\u20135 is the usual balance point; above 7 the CPU cost stops paying for the marginal size reduction.<\/p>\n<h2 class=\"wp-block-heading\">Where Brotli Comes From<\/h2>\n<p class=\"wp-block-paragraph\">IIS itself does not ship a Brotli compression module. You get Brotli in one of three ways:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>.NET hosting with response compression middleware:<\/strong> ASP.NET Core&#8217;s <code>ResponseCompression<\/code> middleware supports Brotli natively. Add <code>BrotliCompressionProvider<\/code> and it negotiates Brotli for clients that advertise <code>br<\/code>, falling back to gzip.<\/li>\n<li><strong>A reverse proxy:<\/strong> Nginx in front of IIS compresses with Brotli via <code>ngx_brotli<\/code>, offloading the work from IIS entirely.<\/li>\n<li><strong>Third-party IIS modules:<\/strong> Community Brotli providers exist but add a maintenance dependency; evaluate before adopting.<\/li>\n<\/ul>\n<pre class=\"wp-block-code\"><code>\/\/ ASP.NET Core Program.cs\nbuilder.Services.AddResponseCompression(o =&gt;\n{\n    o.EnableForHttps = true;\n    o.Providers.Add&lt;BrotliCompressionProvider&gt;();\n    o.Providers.Add&lt;GzipCompressionProvider&gt;();\n    o.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(\n        new[] { \"application\/json\", \"image\/svg+xml\" });\n});<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Brotli typically beats gzip by 15\u201320% on HTML and JSON at equivalent CPU. For a text-heavy site that adds up to real bandwidth savings. The configuration choices here sit alongside the broader IIS tuning covered on <a href=\"https:\/\/windows-vps.org\/\">windows-vps.org<\/a> if you want to see how compression fits the rest of a hosting stack.<\/p>\n<h2 class=\"wp-block-heading\">Choosing the Right Setting<\/h2>\n<p class=\"wp-block-paragraph\">A pragmatic policy that covers most sites:<\/p>\n<ul class=\"wp-block-list\">\n<li>Static gzip: on for <code>text\/*<\/code>, <code>application\/javascript<\/code>, <code>application\/json<\/code>, <code>image\/svg+xml<\/code>.<\/li>\n<li>Dynamic gzip: on only for JSON and generated HTML; leave off for images and fonts.<\/li>\n<li>Brotli: prefer it for dynamic responses when you control the app framework or run a proxy; let gzip remain the fallback.<\/li>\n<li>Never compress already-compressed binaries \u2014 check that <code>Content-Encoding<\/code> is not applied to PNG, JPEG, WebP, MP4, or WOFF2.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\">Verifying the Win and Watching CPU<\/h2>\n<p class=\"wp-block-paragraph\">Do not assume compression is working \u2014 check it. From a client, request an asset and inspect the headers:<\/p>\n<pre class=\"wp-block-code\"><code>curl -sI -H \"Accept-Encoding: gzip, br\" https:\/\/example.com\/ | findstr \/i \"content-encoding content-length\"<\/code><\/pre>\n<p class=\"wp-block-paragraph\">You want to see <code>Content-Encoding: br<\/code> or <code>gzip<\/code> and a reduced <code>Content-Length<\/code>. Then watch the server side: add the <code>% Processor Time<\/code> and <code>Requests\/sec<\/code> counters in Performance Monitor and compare before and after under load. On a memory-constrained Windows VPS, dynamic compression is a trade of RAM and CPU for bandwidth \u2014 if the box is already CPU-bound at peak, enabling it will hurt more than it helps. For most read-heavy sites, static compression alone delivers the bulk of the benefit at almost no runtime cost, and it is the safest place to start before reaching for Brotli.<\/p>\n<h2 class=\"wp-block-heading\">Compression Safety Nets and Common Pitfalls<\/h2>\n<p class=\"wp-block-paragraph\">A few failure modes catch teams out after they enable compression. Double compression is the first: if a CDN or reverse proxy already compresses a response and IIS compresses it again, the payload grows and clients may reject it. Pick one layer to own the job \u2014 usually the edge \u2014 and disable compression upstream where it overlaps. The second is stale static caches: when you update a CSS or JS file, IIS may keep serving the old compressed copy from its temporary folder until the source timestamp changes, so bump the file mtime during deploys. The third is TLS interaction \u2014 do not enable compression on responses containing secrets, because the old BREACH-style attacks exploit the size difference that compression introduces. Finally, watch the temporary compressed-files folder on a small VPS; it can grow quietly and consume system-drive space, so point it at a data volume or cap its size. Locking down the surrounding IIS surface, including the request-filtering and header settings that travel with these tuning changes, is covered in the server hardening notes on <a href=\"https:\/\/windows-vps.org\/\">windows-vps.org<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compression is one of the cheapest performance wins on an IIS-hosted site, and it is also one of the most commonly left on the default. Windows Server ships IIS with static and dynamic compression modules that support gzip out of the box, while Brotli only arrives through cross-platform .NET hosting or third-party modules. Choosing between &#8230; <a title=\"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic\" class=\"read-more\" href=\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/\" aria-label=\"Read more about IIS Compression Explained: Brotli vs gzip and Static vs Dynamic\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-857","post","type-post","status-publish","format-standard","hentry","category-tutorials-guides"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>IIS Compression Explained: Brotli vs gzip and Static vs Dynamic - Windows VPS Blog<\/title>\n<meta name=\"description\" content=\"Compression is one of the cheapest performance wins on an IIS-hosted site, and it is also one of the most commonly left on the default. Windows Server\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic\" \/>\n<meta property=\"og:description\" content=\"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic\" \/>\n<meta property=\"og:url\" content=\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/\" \/>\n<meta property=\"og:site_name\" content=\"Windows VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-11T22:37:51+00:00\" \/>\n<meta name=\"author\" content=\"windows-vps\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@myxiechengxuan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"windows-vps\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/\",\"url\":\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/\",\"name\":\"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic - Windows VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\"},\"datePublished\":\"2026-10-11T22:37:51+00:00\",\"author\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\"},\"description\":\"Compression is one of the cheapest performance wins on an IIS-hosted site, and it is also one of the most commonly left on the default. Windows Server\",\"breadcrumb\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/windows-vps.org\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\",\"url\":\"https:\/\/windows-vps.org\/blog\/\",\"name\":\"Windows VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/windows-vps.org\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\",\"name\":\"windows-vps\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"caption\":\"windows-vps\"},\"sameAs\":[\"https:\/\/windows-vps.org\/blog\",\"https:\/\/x.com\/myxiechengxuan\"],\"url\":\"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic - Windows VPS Blog","description":"Compression is one of the cheapest performance wins on an IIS-hosted site, and it is also one of the most commonly left on the default. Windows Server","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/","og_locale":"en_US","og_type":"article","og_title":"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic","og_description":"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic","og_url":"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/","og_site_name":"Windows VPS Blog","article_published_time":"2026-10-11T22:37:51+00:00","author":"windows-vps","twitter_card":"summary_large_image","twitter_creator":"@myxiechengxuan","twitter_misc":{"Written by":"windows-vps","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/","url":"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/","name":"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic - Windows VPS Blog","isPartOf":{"@id":"https:\/\/windows-vps.org\/blog\/#website"},"datePublished":"2026-10-11T22:37:51+00:00","author":{"@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58"},"description":"Compression is one of the cheapest performance wins on an IIS-hosted site, and it is also one of the most commonly left on the default. Windows Server","breadcrumb":{"@id":"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/windows-vps.org\/blog\/iis-compression-brotli-vs-gzip-static-vs-dynamic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/windows-vps.org\/blog\/"},{"@type":"ListItem","position":2,"name":"IIS Compression Explained: Brotli vs gzip and Static vs Dynamic"}]},{"@type":"WebSite","@id":"https:\/\/windows-vps.org\/blog\/#website","url":"https:\/\/windows-vps.org\/blog\/","name":"Windows VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/windows-vps.org\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58","name":"windows-vps","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","caption":"windows-vps"},"sameAs":["https:\/\/windows-vps.org\/blog","https:\/\/x.com\/myxiechengxuan"],"url":"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/"}]}},"_links":{"self":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/comments?post=857"}],"version-history":[{"count":1,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/857\/revisions"}],"predecessor-version":[{"id":863,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/857\/revisions\/863"}],"wp:attachment":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/media?parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/categories?post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/tags?post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}