Select Page

There are many compression format to use to archive files for many reasons. Listed below are some compression libraries for C# of popular compression format like Zip, 7z/SevenZip, Rar.

GPL with exceptionC# ZIP GZip Tar BZip2

From the site:

#ziplib (SharpZipLib, formerly NZipLib) is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform. It is implemented as an assembly (installable in the GAC), and thus can easily be incorporated into other projects (in any .NET language). The creator of #ziplib put it this way: “I’ve ported the zip library over to C# because I needed gzip/zip compression and I didn’t want to use libzip.dll or something like this. I want all in pure C#.”


  • Source code and samples
  • Support Zip, GZip, Tar, BZip2
  • .NET 1.1, .NET 2.0 (3.5, 4.0), .NET Compact Framework 1.0, .NET Compact Framework 2.0
  • Can be used for commercial / closed source application


The library is released under the GPL with the following exception:

Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination.

As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.


The exception is changed to reflect the latest GNU Classpath exception. Older versions of #ziplib did have another exception, but the new one is clearer and it doesn’t break compatibility with the old one.

Bottom line

In plain English this means you can use this library in commercial closed-source applications.

Ms-PLC# Rar 7-zip Zip Tar GZip BZip2

From the site:

SharpCompress is a compression library for .NET/Mono/Silverlight/WP7 that can unrar, un7zip, unzip, untar unbzip2 and ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented.  The major feature is support for non-seekable streams so large files can be processed on the fly (i.e. download stream).


  • Source code fully C#
  • Support format Rar, 7-zip, Zip, Tar, GZip, BZip2
  • Support for non-seekable streams, large files can be processed on the fly like download stream
  • .NET, Mono, Silverlight, WP7


Freeware, but for detail please check Microsoft Public License (Ms-PL)

Public DomainC# C++ 7-zip LZMA

From the site:

The LZMA SDK provides the documentation, samples, header files, libraries, and tools you need to develop applications that use LZMA compression.


LZMA SDK is placed in the public domain.

Article: C# Use Zip Archives without External Libraries

From the site:

Since .NET 3.0, we can use the System.IO.Packaging ZipPackage class in WindowsBase.DLL. It’s just 1.1 MB, and it just seems to fit a lot better than importing Java libraries.

Problem only that the ZipPackage class isn’t a generic Zip implementation, it’s a packaging library for formats like XPS and Office Open XML that happen to use Zip.

To access simple Zip archives with ZipPackage fails because the content is checked for Package conventions.

For example, there has to be a file [Content_Types].xml in the root and only files with specified extensions are accessible. Filenames with special characters and spaces are not allowed and the access time is not the best because of the additional Package link logic.

However, the assembly WindowsBase.DLL is preinstalled and the generic Zip implementation is inside. The only problem is that the generic Zip classes are not public and visible for the programmers. But there is a simple way to get access to this hidden API and I wrote a small wrapper class for this.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Source do not forget to check the discussion
Ms-PLC# Zip

From the site:

DotNetZip is a FAST, FREE class library and toolset for manipulating zip files. Use VB, C# or any .NET language to easily create, extract, or update zip files.
DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. Create and read zip files in VB, C#, or any .NET language, or any scripting environment.


  • Source code and examples
  • .NET application – Console, Winforms, WPF, ASP.NET, Sharepoint, Web services apps …
  • Supports zip passwords, Unicode, ZIP64, stream input and output, AES encryption, multiple compression levels, self-extracting archives, spanned archives, and more.


Freeware, but for detail please check Microsoft Public License (Ms-PL)

Ms-PL LGPLC# Zip 7-zip Xz GZip BZip2 Tar Rar Cab

From the site:

Managed 7-zip library written in C# that provides data (self-)extraction and compression (all 7-zip formats are supported). It wraps 7z.dll or any compatible one and makes use of LZMA SDK.

SevenZipSharp is an open source wrapper for 7-zip released under LGPL v3.0. It exploits the native 7-zip dynamic link library through its COM interface and exports classes to work with various file archives. The project appeared as an improvement of It supports .NET and Windows Mobile .NET Compact.


  • Encryption and passwords are supported.
  • Archive properties, multi-threading, streaming is supported…
  • Windows Mobile ARM platforms are supported.
  • Extraction from SFX archives, as well as some other formats with embedded archives is supported.
  • Extraction is supported from any archive format in InArchiveFormat – such as 7-zip itself, zip, rar or cab and the format is automatically guessed by the archive signature (since the 0.43 release).
  • Compress streams, files or whole directories in OutArchiveFormat – 7-zip, Xz, Zip, GZip, BZip2 and Tar.
    Please note that GZip and BZip2 compresses only one file at a tme.





1 Comment

  1. Ben Stabile

    DeltaCodec : An Open Source Framework to Directly Compress Generic Lists of Data.

    A “Codec” is a combination of a “Transform” and a “Finisher”. Any general purpose compression algorithm can be used for finishing compression.

    Out of the box there are codecs implemented for:

    * System.IO.DeflateStream
    * DotNetZip (Deflate and BZip2)
    * SharpZipLib (Deflate and BZip2)
    * QuickLZ
    * LZ4
    * … more to be added in the future

    The framework supports compressing lists of 17 simple data types and several compound or multi-field types (e.g. Dictionary, Tuple, etc.). Custom compound data structures are easily added.

    There are a huge number of Performance Tests to compare all codec, data type, and configuration-setting combinations.

    We encourage developers to contribute suggestions, comments, and, of course, new transform and finisher implementations.


Submit a Comment

Your email address will not be published. Required fields are marked *