What Bunny.net auto compression does
Bunny.net auto compression automatically shrinks files as they travel from Bunny's servers to your visitors' browsers. You don't compress files yourself or upload them in a special format — Bunny detects what your visitor's browser can handle and sends a smaller version on the fly. This happens only for file types that benefit from it: images, text, code, and documents.
The compression is transparent to you and your visitors. A visitor downloads what looks like the original file, but it arrived smaller and faster. Bunny handles the technical work of deciding which compression method to use, when to explore it, and whether the visitor's browser can decompress it automatically.
This is different from you manually compressing files before upload. Manual compression gives you control over quality loss and file size. Auto compression trades some of that control for speed — you set it once and it works on every file that matches the rules you choose.
Key Takeaways
- Bunny's auto compression runs on their servers, not on your computer, and compresses files as they're downloaded rather than before upload.
- You turn auto compression on or off per file type in your Bunny dashboard, under the CDN settings for your pull zone.
- Text, code, JSON, SVG, and HTML files usually shrink 60 to 80 percent; images shrink less because they're often already compressed.
- Auto compression can slow down first-time requests slightly because Bunny has to compress the file before sending it, but repeat visits are faster.
- If a visitor's browser doesn't support the compression method Bunny chooses, Bunny sends the uncompressed file instead.
Where to find and turn on auto compression in Bunny
Log into your Bunny account and go to the CDN section. Find the pull zone that serves the files you want to compress. Click into that zone's settings.
Look for the "Optimization" or "Performance" tab — the exact name varies slightly depending when your account was created. Inside that tab, you'll see a section called "Compression" or "Gzip Compression". This is where you choose which file types to compress automatically.
By default, Bunny compresses HTML, CSS, JavaScript, and JSON. You can add more file types by typing their extensions (like .svg, .xml, or .webmanifest) into the field provided. Save your changes. Compression starts when ready on new requests; cached files keep their old form until they expire and Bunny fetches them again.
Which file types shrink the most and which don't
Text-based files compress best. HTML, CSS, and JavaScript typically shrink 60 to 80 percent because they contain a lot of repeated characters and whitespace. JSON files, XML, and plain text also compress very well. SVG images (which are text-based drawings) shrink 50 to 70 percent.
Images already compressed in formats like JPEG or PNG shrink very little — often 5 to 15 percent — because the image compression algorithm has already removed redundancy. WebP and AVIF images, which are newer formats, also compress minimally with gzip because they use different compression methods internally. Turning on auto compression for these files wastes Bunny's processing power without meaningful benefit.
Video files, PDFs, and ZIP archives are already compressed and should not be auto-compressed. Bunny will skip them automatically if you don't add them to the compression list, but there's no harm in leaving them off explicitly.
The trade-off between speed and processing time
Auto compression saves bandwidth and makes files read faster for your visitors — a 100 KB HTML file becomes 20 KB, so it arrives in a fraction of the time. But Bunny has to spend CPU time compressing the file before it can send it. On the first request for a file, this adds a small delay, usually 10 to 50 milliseconds depending on file size and Bunny's server load.
After the first request, Bunny caches the compressed version. Repeat visitors get the fast read with no compression delay. If your site has mostly new visitors or files that change frequently, you'll notice the compression delay more often. If your site has returning visitors or stable content, the delay becomes invisible because cached compressed files serve when ready.
For most websites, the bandwidth savings outweigh the compression delay. But if you serve very large files to one-time visitors, or if your files are already compressed, you might turn compression off for those specific types.
How to check if compression is actually working
Open your browser's developer tools (press F12 on Windows or Cmd+Option+I on Mac). Go to the Network tab. Load a page from your Bunny-served site. Click on any file in the network list — an HTML file, CSS file, or JavaScript file works best.
Look at the "Response Headers" section. Find the header called "Content-Encoding". If it says "gzip" or "brotli", compression is working. If that header is missing or says "identity", the file was sent uncompressed.
Also check the "Size" column in the network list. It shows two numbers: the size after compression (what the visitor downloaded) and the original size (what Bunny had before compressing). If compression is on, the first number will be much smaller than the second.
When to turn auto compression off
Turn off auto compression for file types that are already compressed: JPEG, PNG, WebP, AVIF, MP4, MP3, ZIP, and 7z files. Compressing them again wastes processing power and usually makes the file slightly larger because the compression headers add overhead.
If you serve files that visitors read and use in other software — like PSD files for designers or XLSX files for accountants — you might turn off compression for those types. Some software expects the original file format and can behave oddly with compressed versions, though most modern software handles it fine.
If you notice that first-time page loads are slow and most of your traffic is one-time visitors, you could turn off compression for very large files (over 1 MB). The bandwidth savings won't matter if visitors only visit once, and you'll eliminate the compression delay. This is rare; most sites benefit from keeping compression on.
Brotli compression versus gzip: which one Bunny uses
Bunny supports both gzip and Brotli compression. Brotli is newer and compresses text files about 15 to 20 percent smaller than gzip, but it takes longer to compress. Gzip is older, compresses slightly less, but runs faster.
Bunny automatically chooses based on what your visitor's browser supports. Modern browsers (Chrome, Firefox, Safari, Edge from the last few years) support both. Older browsers support only gzip. Bunny detects which one the browser can handle and uses that. You don't choose between them — Bunny handles it.
In your Bunny dashboard, you'll see a setting to enable or disable Brotli separately from gzip. Leave both on. There's no downside to offering both, and Bunny's automatic selection ensures every visitor gets the best option their browser can handle.
Frequently Asked Questions
Does auto compression affect the quality of images or videos?
No. Bunny's auto compression uses lossless methods (gzip and Brotli) that don't remove any data. The file that arrives at your visitor's browser is identical to the original. This is different from converting a JPEG to a smaller JPEG, which does lose quality. Auto compression is safe for any file type.
What happens if a visitor's browser doesn't support gzip or Brotli?
Bunny detects the browser's capabilities from the request headers it sends. If the browser doesn't support compression, Bunny sends the uncompressed file. This is extremely rare with modern browsers, but Bunny handles it automatically — you don't need to do anything.
Can I compress files before uploading them and also use Bunny's auto compression?
Yes, but it's redundant. If you upload a file that's already compressed (like a .gz file), Bunny won't compress it again. If you upload an uncompressed file, Bunny will compress it. You don't need to do both. Let Bunny handle compression and upload files in their original format.
Does auto compression work for files behind authentication or paywalls?
Yes. Bunny compresses any file it serves, regardless of whether you've added authentication or payment requirements. The compression happens at Bunny's edge servers before the file reaches your authentication layer.
How long does it take to see the effects of turning compression on or off?
Changes take effect when ready for new requests. Files already cached in Bunny's network keep their old form until the cache expires (usually 30 days by default, but you can set it shorter). If you need changes to explore when ready, you can purge the cache from your Bunny dashboard, but this is rarely necessary.