RAR libraries
Open-source libraries that list and extract RAR archives. RAR is proprietary and no open-source library creates RAR files; to write archives use ZIP, 7z or TAR.
Many RAR libraries are built on RARLAB’s UnRAR source. Its license is free but not an OSI open-source license: the code may be used in any program that extracts RAR, but not to re-create the RAR compression algorithm. Libraries marked “UnRAR license” below carry that restriction; libarchive, SharpCompress and rardecode are independent implementations under BSD or MIT licenses.
| Language | Library | RAR4 | RAR5 | Password | Volumes | Notes |
|---|---|---|---|---|---|---|
| C/C++ | UnRAR library | yes | yes | yes | yes | reference code from RARLAB, UnRAR license |
| C/C++ | libarchive | yes | yes | no | yes | BSD, same API for ZIP, 7z, TAR; no solid RAR4 |
| C# | SharpCompress | yes | yes | yes | yes | pure managed code, MIT |
| Java | junrar | yes | yes | yes | yes | pure Java, UnRAR license |
| Go | rardecode | yes | yes | yes | yes | pure Go, BSD-2-Clause, io/fs support |
| Python | rarfile | yes | yes | yes | yes | zipfile-like API, runs unrar or another tool to decompress |
| Ruby | ffi-libarchive | yes | yes | no | no | libarchive binding, same limits as libarchive |
| Rust | unrar | yes | yes | yes | yes | binding to the UnRAR library |
| PHP | rar extension | yes | yes | yes | yes | PECL extension with bundled UnRAR, rar:// stream wrapper |
By language#
- RAR libraries for C/C++ C and C++ libraries to extract RAR archives: RARLAB's UnRAR library and libarchive. RAR4 and RAR5, passwords, volumes and licenses compared.
- RAR libraries for C# C# and .NET library to extract RAR archives: SharpCompress reads RAR4 and RAR5, encrypted and multi-volume archives in pure managed code.
- RAR libraries for Java Java library to extract RAR archives: junrar reads RAR4 and RAR5, encrypted and multi-volume archives in pure Java. License and code examples.
- RAR libraries for Go Go library to extract RAR archives: rardecode reads RAR4 and RAR5, encrypted, solid and multi-volume archives in pure Go, with an io/fs interface.
- RAR libraries for Python Python library to extract RAR archives: rarfile reads RAR4 and RAR5 with a zipfile-like API and uses unrar, 7-Zip, unar or bsdtar to decompress.
- RAR libraries for Ruby Ruby library to extract RAR archives: ffi-libarchive binds libarchive, which reads RAR4 and RAR5 archives without passwords.
- RAR libraries for Rust Rust crate to extract RAR archives: unrar wraps RARLAB's UnRAR library and reads RAR4 and RAR5, encrypted and multi-volume archives.
- RAR libraries for PHP PHP extension to extract RAR archives: the rar extension (PECL / PIE) reads RAR4 and RAR5 with the bundled UnRAR library and adds a rar:// stream wrapper.