Compression Detector
Instantly identify file compression formats using our compression detector. Analyze magic bytes and entropy to verify GZIP, ZIP, RAR, 7Z, and TAR archives today.
Related Utilities
The Mathematical Foundation of File Entropy in a Compression Detector
At the core of identifying binary data lies the concept of Shannon entropy, a measure of unpredictability within a data stream. A reliable compression detector relies on this mathematical principle to differentiate between high-density compressed files and raw, uncompressed binary data. When data is compressed, the frequency distribution of bytes tends toward uniformity, resulting in higher entropy values, typically nearing the theoretical maximum of 8 bits per byte.
$$H(X) = - \sum_{i=0}^{255} P(x_i) \log_2 P(x_i)$$
In this equation, $P(x_i)$ represents the probability of a specific byte value appearing in the file. Files with high entropy—usually exceeding 7.5 bits—are statistically likely to be compressed or encrypted. Our compression detector calculates this value to provide a confidence interval for files that lack standard recognizable signatures.
Why Magic Bytes Matter for Your Compression Identifier
While entropy provides a probabilistic guess, "magic bytes" provide certainty. These are specific sequences of bytes located at the beginning of a file, acting as a unique fingerprint for a specific format. A reliable compression identifier scans the initial 8 bytes of a file against known signatures to determine its structure instantly.
For instance, a GZIP file always starts with the hex sequence 1F 8B, while a 7-Zip archive begins with the unmistakable 37 7A BC AF 27 1C. By comparing these headers against a pre-defined catalog, the tool performs a deterministic identification that bypasses the need for complex, time-consuming decompression. This method is the industry standard for file type validation in systems programming.
Signature Comparison Table for Common Archive Formats
To effectively utilize this compression detector, it is helpful to understand the hex signatures it looks for during file analysis. The following table maps common archive formats to their defining magic bytes.
| Format | Magic Bytes (Hex) | Reliability |
|---|---|---|
| GZIP | 1F 8B | High |
| ZIP | 50 4B 03 04 | High |
| Bzip2 | 42 5A 68 | High |
| RAR | 52 61 72 21 | High |
| 7-Zip | 37 7A BC AF 27 1C | High |
| Zlib | 78 01, 78 9C, 78 DA | Moderate |
| TAR | 75 73 74 61 72 (at offset 257) | Moderate |
Configuring Your Compression Detector Inputs
Before running an analysis, you must select the appropriate input mode to match your data source. The tool supports three distinct methods, each optimized for different workflows.
- Hex Mode: Best for raw binary analysis where you have copied the header dump from a hex editor. Ensure your input is stripped of
0xprefixes for accurate parsing. - Base64 Mode: Ideal for scenarios where the file content has been encoded into a string format, commonly found in JSON payloads or API responses.
- File Mode: The most convenient option for local file verification. This mode reads the raw bytes directly from your disk, ensuring no data modification occurs before the scan.
Verifying File Integrity with the Compression Identifier
Sometimes a file extension might be misleading, or a download could be corrupted. The verification feature allows you to input an expected format name—such as "zip" or "gzip"—to confirm that the underlying magic bytes actually match the file's designation. If the compression detector finds a mismatch, it indicates that the file may be mislabeled, truncated, or potentially malicious.
50 4B 03 04 0A 00 00 00
ZIP Archive (.zip)
Confidence: 99%
Step-by-Step Analysis with the Compression Detector
Follow these steps to identify your archive type using the interface provided.
Select Input Mode
Choose between "hex", "base64", or "file" based on the data you possess.
Provide Data
Paste your raw hex or base64 string, or use the "Choose File" button to upload your target document.
Review Identification
Examine the "Compression Identification" panel to see the primary guess, the detected magic header, and the calculated entropy level.
Validate Expectations
Type your expected format into the "Verify expected format" field and click "Match Expected Format" to confirm the signature match.
Interpreting Entropy Results for Unknown Binary Files
When a file lacks a standard magic header, the compression detector falls back to its entropy analysis. An entropy value between 7.5 and 8.0 suggests the file is either highly compressed or encrypted. If the value is substantially lower, the file is likely a raw binary or text document. Understanding these thresholds is critical when dealing with proprietary or non-standard file formats that do not follow traditional archive signatures.
Quick Reference: Compression Identifier Data Handling
- Header Matching: The tool scans the first 8 bytes of the data block to confirm format identity.
- Entropy Calculation: Computed across the entire data stream to differentiate between compressed and uncompressed content.
- TAR Detection: Unlike other formats, the tool specifically checks for the "ustar" string at the 257-byte offset, acknowledging the unique structure of POSIX-compliant tarballs.
- Signature Sorting: Results are presented based on confidence percentages, with 99% indicating a perfect magic byte match.
Why does the compression detector sometimes report "Highly Compressed / Encrypted Binary"?
How does the tool determine the confidence percentage?
What should I do if my ZIP file is not detected?
50 4B 03 04) to identify standard ZIP archives.
Which input format is the most accurate for this compression identifier?
Can this tool identify encrypted archives?
What's the difference between the Zlib and GZIP signatures?
1F 8B) and metadata, whereas Zlib streams start with specific markers like 78 01 or 78 9C.