WebTools

307 Useful Tools & Utilities to make life easier.

GZIP Compression Test

Test if Gzip is working on your website.

Enter the complete URL of the website you want to test for GZIP compression.

Understanding GZIP Compression and Performance

Modern web servers use data compression techniques to reduce the size of HTTP responses before they are transmitted over the network. GZIP is one of the most widely supported compression algorithms, significantly reducing the bandwidth required to serve HTML documents, stylesheets, and JavaScript files. Activating GZIP on your server can decrease payload sizes by up to 70-80%, resulting in faster page load times, lower bandwidth costs, and improved Core Web Vitals scores for search engine optimization.

How This GZIP Diagnostic Tool Works

Unlike basic header checkers, this tool performs a comprehensive analysis of the target URL by actively simulating HTTP requests and performing dynamic compression. Under the hood, the system executes the following sequence:

  • Dual HTTP Requests: The tool initiates two separate HTTP GET requests to your specified URL. The first request explicitly includes the Accept-Encoding: gzip, deflate header to signal that the client accepts compressed data. The second request omits this header to fetch the raw, uncompressed payload.
  • SSL and Redirection Handling: The underlying HTTP client is configured to follow redirects automatically and explicitly bypasses SSL verification (verify => false). This ensures that the tool can successfully test local development servers or staging environments utilizing self-signed SSL certificates. Each request is capped with a strict 30-second timeout.
  • Header Inspection: To verify if GZIP is truly active, the tool parses the response headers from the first request, specifically looking for the Content-Encoding: gzip key. It also gracefully handles reverse proxies or CDNs by checking for the x-encoded-content-encoding fallback header.
  • Level 9 Compression Simulation: Rather than relying solely on the server's reported sizes, the tool utilizes PHP's internal gzencode() function to forcefully compress the raw HTML payload at the maximum possible compression level (level 9). This allows it to calculate the theoretical maximum bandwidth savings possible for the page.
  • Dynamic UI State: The frontend is powered by Alpine.js. When a test is initiated, Alpine toggles a loading state that instantly disables the submit button and displays a spinner. If the system detects an unsolved reCAPTCHA challenge, a custom JavaScript listener intercepts the submission and explicitly resets the Alpine loading state to prevent a frozen UI.

Detailed Breakdown of the Metrics

When the analysis is complete, the tool presents several calculated metrics based on the dual-request data:

  • Original Size: The total byte length of the uncompressed HTTP response body, calculated via strlen() and represented in both kilobytes (kb) and bytes (b).
  • GZIP Size: The simulated compressed size of the page content after applying level 9 GZIP encoding.
  • Compression Percentage: A dynamically calculated float representing the precise percentage of byte reduction achieved, derived using the formula: ((Original Size - GZIP Size) / Original Size) * 100.
  • Request Time: The total time taken to complete the initial HTTP request, measured using PHP's microtime(true) and scaled to milliseconds (ms).
  • Compression Time: The CPU time required by the server running this tool to encode the uncompressed payload at compression level 9.
  • Server & Content-Type: Extracted directly from the server's HTTP response headers (e.g., nginx or text/html; charset=UTF-8).

Worked Example

Let's look at how the tool processes a standard web page request. Suppose you enter https://example.com/article.

The tool fires the first request with the GZIP Accept-Encoding header. The server responds with an HTTP 200 status code, and the tool intercepts the headers, verifying that Content-Encoding: gzip is present. The tool records the request time as 145.20ms.

Next, the tool checks the length of the decompressed response body, determining the Original Size to be 102,400 bytes (100.00kb).

The tool then fires the second request, retrieves the raw uncompressed body, and passes it through the gzencode() function at level 9. This local CPU operation takes 2.45ms (the Compression Time). The resulting compressed string is exactly 25,600 bytes (25.00kb).

Finally, the tool calculates the bandwidth savings: ((102400 - 25600) / 102400) * 100, resulting in a Compression Percentage of exactly 75.00%. The tool outputs these exact metrics alongside the HTTP Status (200), Server header (e.g., Apache/2.4.41), and Content-Type (text/html) into the results table.

Frequently Asked Questions

Why does the tool execute two separate HTTP requests?

To accurately calculate the compression ratio, the tool needs both the compressed payload and the raw, uncompressed payload. The first request (with compression headers) validates that your server is configured to deliver GZIP correctly. The second request (without compression headers) fetches the raw body, which the tool then uses to dynamically simulate maximum-level compression.

What does "Compression Time" actually measure?

The Compression Time metric does not represent how long your server took to compress the file. Instead, it measures the CPU time it takes for our tool's server to compress your page's raw HTML using PHP's gzencode() function at level 9. This serves as a benchmark for the computational cost of applying aggressive compression to your specific payload.

Will this tool work on URLs with invalid SSL certificates?

Yes. The underlying HTTP client is explicitly configured with 'verify' => false, which bypasses SSL/TLS certificate validation errors. This allows you to test internal URLs, staging sites, or servers with expired or self-signed certificates without encountering connection exceptions.

What happens if the target URL redirects to another page?

The tool's HTTP client is set to follow redirects automatically ('allow_redirects' => true). It will seamlessly follow 301 and 302 redirects to the final destination and perform the full GZIP and timing analysis on the ultimate response body.

Why might the tool report that GZIP is not enabled even though I enabled it?

The tool strictly checks the response headers for either Content-Encoding: gzip or the proxy-fallback x-encoded-content-encoding: gzip. If your server is compressing the body but failing to append the correct HTTP headers, or if an intermediate firewall, proxy, or CDN is stripping these headers before the response reaches our tool, it will register as disabled.

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us