{"uid":"cap_YhDqT2EK6_FcJ8hpIV2ng","slug":"compression-algorithm-comparison-gzip-vs-brotli-vs-deflate-c516083b","name":"Compression Algorithm Comparison (gzip vs brotli vs deflate)","description":"Run the same input through gzip, brotli, and raw deflate at max settings and report each one's output size and ratio. Use this to decide which algorithm to actually use - the answer depends on your content (binary often resists compression entirely; English prose squeezes well with brotli; JSON sits in between).","url":"https://agent402.tools/api/compress-compare","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"input":{"type":"string","description":"Content to test (max 10MB after decoding)"},"inputFormat":{"type":"string","description":"How `input` is encoded: utf8 (default), base64, or hex"}}},"responseSchema":{"type":"json","example":{"best":"brotli","results":[{"ratio":0.6782,"algorithm":"brotli","outputBytes":28},{"ratio":0.5287,"algorithm":"gzip","outputBytes":41},{"ratio":0.6667,"algorithm":"deflate","outputBytes":29}],"inputBytes":87}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm__bHCRYILB5OQvEoAW6C1P","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs input content through gzip, brotli, and raw deflate at maximum compression settings and returns the output size and compression ratio for each algorithm.","exampleAgentPrompt":"I want to pick the best compression algorithm for my API response payload — can you run this JSON string through gzip, brotli, and deflate at max settings and tell me the output size and ratio for each: '{\"users\":[{\"id\":1,\"name\":\"Alice\"},{\"id\":2,\"name\":\"Bob\"}]}'?","exampleUseCases":null,"resultDescription":"Returns the compressed output size in bytes and the compression ratio for each of the three algorithms (gzip, brotli, raw deflate), allowing comparison to determine which algorithm is most effective for the given input content.","failureModes":["Input exceeds 10MB limit after decoding — request rejected","Invalid inputFormat value (must be utf8, base64, or hex) — bad request error","Malformed base64 or hex encoding when non-utf8 format is specified","Payment not provided or insufficient — 402 Payment Required","Empty input string — may return trivial results or error"],"whenToPreferThis":"Use this endpoint when you need to make an informed decision about which compression algorithm to deploy for a specific content type. It is especially valuable before committing to a compression strategy in production, since optimal algorithm choice is highly content-dependent (text compresses well, binary often does not). Prefer this over running individual compression endpoints when you want a side-by-side comparison in a single call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T19:14:07.213Z","isFirstParty":false}