All formats

7z libraries

Open-source libraries that read and write 7z archives. Fewer languages have native 7z support than ZIP: some libraries are pure implementations of the format, others wrap the 7-Zip DLL / shared library or the 7z command-line program. Check what you need before you choose: writing, encryption (AES-256), solid archives and the compression methods in the files you get (LZMA2, BCJ2, PPMd, Zstandard).

Language Library Read Write Notes
C/C++ libarchive yes yes one API for many archive formats; no encryption
C/C++ LZMA SDK yes no (in C) public domain reference decoder by the author of 7-Zip
C/C++ bit7z yes yes C++ wrapper of the 7-Zip DLL / shared library; encryption, all methods
C# SharpCompress yes yes pure managed; writes non-solid LZMA/LZMA2 archives
C# SevenZipExtractor yes no wraps 7z.dll, Windows only
Java Apache Commons Compress yes yes pure Java, reads encrypted archives
Go sevenzip yes no pure Go, archive/zip-like API, fs.FS
Python py7zr yes yes pure Python, encryption, zipfile-like API
Python libarchive-c yes yes ctypes binding to libarchive
Ruby seven-zip yes yes native extension bundling 7-Zip code
Ruby ffi-libarchive yes yes FFI binding to libarchive
Rust sevenz-rust2 yes yes pure Rust, AES-256, solid and non-solid
PHP Archive7z yes yes wrapper of the 7-Zip command-line program

By language#