Top 60 Compression Methods

Top 60 Compression Methods

IDCompression MethodDescriptionBest For
1ZIPWidely used for compressing files, supported by WinZip and 7-Zip.General files
2RARA proprietary archive file format that supports data compression. Used primarily by WinRAR.Archiving, general files
3gzipA software application based on the DEFLATE algorithm, primarily used in GNU systems.Text, web, UNIX files
4bzip2High-compression file archiver.Text, source code
5LZMAKnown for a high compression ratio, supported by 7-Zip and LZMA SDK.General files
6LZ77A universal lossless data compression algorithm utilized by many tools, e.g., zlib.Text, general data
7Zstandard (zstd)Real-time compression algorithm, developed by Facebook.Real-time applications
8BrotliCompression algorithm developed by Google, primarily for web fonts and HTTP compression.Web content
9DEFLATELossless data compression algorithm used in zlib.PNG images, web content
10LZWCommon in GIF format and the compress command in UNIX.Graphics (GIF)
11PAQA series of archivers with high compression ratios but slower speeds.Archiving
12xzUses the LZMA2 compression algorithm, great for distributing software packages.Software packages
13LZOEmphasizes speed over compression ratio.Fast real-time compression
14LZ4Known for its extremely fast compression and decompression.Real-time applications
15SnappyDeveloped by Google, prioritizes speed.Large-scale data storage
16FLACLossless audio codec.Audio files
17ALACApple's lossless audio codec.Audio files on Apple devices
18JPEGWidely used lossy compression for digital images. Many tools available, like libjpeg and JPEGView.Photographs
19JPEG 2000An improved version of JPEG with better compression and quality.Digital cinema, medical imaging
20PNGLossless compression for images. Ideal for web graphics with transparency.Web graphics, images
21TIFFVersatile format supporting various compression algorithms.High-quality images
22WebPDeveloped by Google, supports both lossless and lossy compressions.Web images
23VP8, VP9Video codecs developed by Google, used in WebM format.Online streaming videos
24H.264/AVCWidely used video compression standard. Supported by tools like x264 and HandBrake.Video streaming, broadcasting
25H.265/HEVCSuccessor to H.264, offers better compression at the same quality level.Ultra-HD video, streaming
26OpusAudio codec designed for the internet, excellent at low bitrates.Internet audio, VoIP
27VorbisOpen audio compression format under the Ogg format.Audio streaming
28WAVPACKHybrid lossless audio codec.High-fidelity audio archiving
29APEMonkey's Audio is a fast and powerful lossless audio compressor.Lossless audio compression
30TARArchive format commonly used in UNIX environments. No compression, just grouping.Grouping files on UNIX
31CABMicrosoft's cabinet compressed archive format.Windows installations, software packages
327zHigh-compression format supported by 7-Zip software.General archiving, high compression
33SquashFSCompressed read-only file system for Linux.Embedded systems, Live CDs
34CPIOOld UNIX archiving tool.Archiving on UNIX
35ARJFile archiver for DOS.Old DOS archives
36StuffItPopular on Mac OS before the rise of ZIP.Old Mac OS archives
37ACEOld but efficient compression tool, less popular nowadays.Legacy archives
38LHA/LZHA compression algorithm commonly used in Japan.Old Japanese archives
39JARJava Archive, used to package Java classes and associated metadata & resources.Java applications
40Pack200Java compression tool, part of the SDK, good for compressing Java archives.Java archives (JAR)
41MTFMicrosoft Tape Format used for backups.Windows backups
42ARCOld archival format, predates ZIP. Supported by ARC and FreeARC.Legacy archives
43PAR2Used to check and recover missing data for multi-part archives.Usenet archives, file recovery
44ZPAQHighly efficient archiver with journaling capability.Efficient archiving
45PVMParallel Virtual Machine, not strictly compression but a middleware for parallel computing.Parallel computing (not compression)
46HuffYUVA very fast, lossless video codec.Lossless video compression
47Apple ProResProfessional video codec developed by Apple.Video editing on Apple devices
48CinepakEarly video codec by SuperMac Technologies, once common in early CD-ROM video games.Legacy video files
49SorensonFamily of video codecs that were popular in early web video.Early web videos
50IndeoVideo codec developed by Intel.Legacy video applications
51LZ78Successor to LZ77, basis for several other algorithms.General-purpose text compression.
52BWTData transformation that prepares data for better compression.Full-text database indexes and large text datasets.
53Delta EncodingRepresents data as differences between sequential data rather than complete files.Version control databases and sequential log files.
54Dictionary EncodingReplaces repeated occurrences of data with references to a set dictionary.Databases with redundant textual data.
55Columnar CompressionCompression method where data is stored as columns rather than rows, ideal for modern databases.Columnar databases, analytics databases.
56Run-Length Encoding (RLE)Represents sequences of identical bytes by a single byte and a count.Simple textual databases with lots of repeated sequences.
57Prefix EncodingRepresents common prefixes once to save space.Databases with hierarchical textual data, like XML.

compress methods


@echo off
setlocal enabledelayedexpansion

:: Compress the file or directory
compact /c "path_to_file_or_directory"

:: Slice the compressed file using PowerShell
powershell -command "& {
    $filename = 'path_to_compressed_file';
    $chunkSize = 10MB;
    $counter = 1;

    Get-Content $filename -ReadCount ([math]::Round((Get-Item $filename).length / $chunkSize)) |
    ForEach-Object {
        Set-Content ($filename + '.' + $counter) -Value $_;


mksquashfs mydir mydir.sqsh

Run-Length Encoding (RLE)

def rle_encode(data):
    encoding = []
    prev_char = data[0]
    count = 1

    for char in data[1:]:
        if char == prev_char:
            count += 1
            encoding.append((prev_char, count))
            count = 1
            prev_char = char

    encoding.append((prev_char, count))
    return encoding

def rle_decode(data):
    return ''.join([char * count for char, count in data])

# Test
encoded = rle_encode(data)
print(encoded) # [('A', 3), ('B', 3), ('C', 2), ('D', 1), ('A', 2)]
print(rle_decode(encoded)) # "AAABBBCCDAA"


compress_rle() {


    while IFS= read -r -n1 char; do
        if [[ "$char" == "$prev_char" ]]; then
            if [[ -n "$prev_char" ]]; then
                echo -n "$prev_char$count" >> "$output_file"
    done < "$input_file"

    echo -n "$prev_char$count" >> "$output_file"

compress_rle "input.txt" "output.rle"


# Compress a folder using PowerShell
$sourceFolder = "C:\path\to\source\folder"
$destinationFile = "C:\path\to\destination\"

Compress-Archive -Path $sourceFolder -DestinationPath $destinationFile


7z a output_archive_name.7z path_to_directory_or_file


7z a -t7z -v50m myarchive.7z C:\path\to\my\folder


7z a -t7z -v50m myarchive.7z C:\path\to\my\folder


rar a -v100m output_archive_name.rar path_to_directory_or_file


rar a -v50m myarchive.rar C:\path\to\my\folder


import zlib
import sys

def compress_and_slice(input_file, output_base, slice_size):
    with open(input_file, 'rb') as f:
        data =
        compressed = zlib.compress(data)

        num_slices = (len(compressed) // slice_size) + (1 if len(compressed) % slice_size else 0)
        for i in range(num_slices):
            start = i * slice_size
            end = start + slice_size
            with open(f"{output_base}.{i:03}", 'wb') as out_f:

if __name__ == "__main__":
    if len(sys.argv) < 4:
        print("Usage: python input_file output_base slice_size_in_bytes")

    input_file = sys.argv[1]
    output_base = sys.argv[2]
    slice_size = int(sys.argv[3])

    compress_and_slice(input_file, output_base, slice_size)

python input.txt compressed 100000


tar czvf - path_to_directory_or_file | split -b 100M - compressed.tar.gz.


tar cjvf - path_to_directory_or_file | split -b 100M - compressed.tar.bz2.


gzip -c input_file > output_file.gz


split -b 100M output_file.gz sliced_output.gz.

Xpress Compression Algorithm


makecab /D CompressionType=MSZIP input_file


makecab /D CompressionType=MSZIP /D MaxDiskSize=100M input_file

Xpress Compression (Template)

#include "pch.h"
#include "MainPage.xaml.h"
#include "SampleConfiguration.h"
#include "CompressionUtils.h"

using namespace Windows::Storage;
using namespace Windows::Storage::Pickers;
using namespace Windows::Storage::Streams;
using namespace Windows::Storage::Compression;

using namespace concurrency;

#pragma region ReadStreamTask implementation
// We can't derive from task because we need to initialize task_completion_event before task itself.
struct ReadStreamTask::ReadStreamTaskImpl {
    ReadStreamTaskImpl(IInputStream^ Stream, std::vector<byte> &Destination) :
        _Reader(ref new DataReader(Stream)),

    task<size_t> RunTask()
        return create_task(_CompletionEvent).then([this]
            // Schedule resource deallocation
            std::unique_ptr<ReadStreamTaskImpl> thisHolder(this);

            // Prevent user provided stream from being closed

            // Move data out
            _Destination = std::move(_StreamData);

            return _Destination.size();

    void ReadChunk()
        // LoadAsync itself could throw exception if IAsyncOperation couldn't be created with
        // given parameters in a current state
            // Read data into the data reader
            _StreamData.reserve(_StreamData.size() + MinReadChunkSize);
            create_task(_Reader->LoadAsync(static_cast<unsigned int>(_StreamData.capacity() - _StreamData.size())))

            // Then store it to the result vector
            .then([this](task<unsigned int> BytesRead)
                    // exception is thrown here if LoadAsync operation has been completed with an error
                    auto bytesRead = BytesRead.get();
                    if (bytesRead)
                        // Store chunk of data in the result vector.
                        auto newData = ref new Platform::Array<byte>(bytesRead);

                        _StreamData.insert(_StreamData.end(), newData->begin(), newData->end());

                        // Then recurse to read next chunk.
                        // End of stream is reached - complete top level task with the data we've read so far

                        // make sure that _CompletionEvent outlives continuation which deletes this ReadStreamTaskImpl
                        auto completionEvent = _CompletionEvent;
                catch (...)
                    // Schedule resource deallocation
                    std::unique_ptr<ReadStreamTaskImpl> thisHolder(this);

        catch (...)
            // Schedule resource deallocation
            std::unique_ptr<ReadStreamTaskImpl> thisHolder(this);


    // All data members are accessed serially - no synchronization is done
    std::vector<byte> &_Destination;
    DataReader^ _Reader;
    std::vector<byte> _StreamData;

    task_completion_event<void> _CompletionEvent;

ReadStreamTask::ReadStreamTask(IInputStream^ Stream, std::vector<byte> &Destination) :
    _Impl(new ReadStreamTaskImpl(Stream, Destination))

ReadStreamTask::ReadStreamTask(const ReadStreamTask& Task) :

ReadStreamTask &ReadStreamTask::operator=(const ReadStreamTask& Task)
    _Impl = Task._Impl;
    return *this;

task<size_t> ReadStreamTask::RunTask()
    return _Impl->RunTask();
#pragma endregion


Dism /Capture-Image /ImageFile:"path_to_output.wim" /CaptureDir:"path_to_input_directory" /Name:"ImageName" /Compress:LZMS


lz4 file


#include "lz4.h"

int main() {
    char original_data[] = "data to be compressed";
    char compressed_data[128];
    char decompressed_data[128];

    int compressed_size = LZ4_compress_default(original_data, compressed_data, sizeof(original_data), sizeof(compressed_data));
    int decompressed_size = LZ4_decompress_safe(compressed_data, decompressed_data, compressed_size, sizeof(decompressed_data));

    return 0;



encrypts with the algorithm and a hardcoded key prior to exfiltration

7z a -v50m encrypted_slices.7z encrypted.7z


openssl enc -des-ede3-cbc -in myarchive.7z -out encrypted.7z -K yourhardcodedkey -iv yourinitializationvector


7z a -t7z -m0=lzma myarchive.7z /path/to/your/data


openssl enc -rc4 -in myarchive.7z -out myarchive_encrypted.7z -pass pass:YourPassword


makecab C:\path\to\your\sourcefile.ext C:\destination\path\


.Set DiskDirectoryTemplate=C:\destination\path
.Set CompressionType=MSZIP

and run makecab /F instructions.ddf


snzip inputfile.txt




zstd inputfile.txt