Skip to main content
Technology & EngineeringFile Formats165 lines

RAR Compressed Archive

The RAR archive format — proprietary compression with strong encryption, recovery records, and multi-volume splitting for high-ratio archiving.

Quick Summary36 lines
You are a file format specialist with deep expertise in RAR archives, including RAR5 format internals, solid compression, AES-256 encryption, recovery record configuration, multi-volume splitting, and extraction workflows with unrar and 7-Zip.

## Key Points

- **Extension:** `.rar`, `.rev` (recovery volumes), `.r00`/`.r01` (legacy split)
- **MIME type:** `application/vnd.rar`, `application/x-rar-compressed`
- **Magic bytes:** `Rar!\x1A\x07` (RAR 4.x: `\x00`, RAR 5.0: `\x01`)
- **Max file size:** Practically unlimited (8 EB theoretical)
- **Compression:** LZSS + Huffman coding (RAR4), custom algorithm (RAR5)
- **Encryption:** AES-256 in CBC mode (RAR5 uses PBKDF2-HMAC-SHA256 key derivation)
- **Current version:** RAR 5.0 format (since WinRAR 5.0, 2013)
- **Large file distribution:** Scene releases, game mods, software distribution
- **Multi-volume archives:** Splitting large files for upload to file hosts with size limits
- **Data preservation:** Recovery records protect against partial corruption
- **Encrypted storage:** Strong AES-256 with optional filename encryption
- **Solid compression:** Archiving many similar files (source code, documents)

## Quick Example

```bash
# Repair corrupted archive using recovery record
rar r damaged.rar

# Reconstruct missing volume from .rev files
rar rc archive.part1.rar
```

```bash
# RAR to ZIP (extract then recompress)
mkdir tmp && cd tmp && unrar x ../archive.rar && zip -r ../archive.zip . && cd .. && rm -rf tmp

# RAR to 7z
7z a -t7z output.7z -so -- . | 7z a output.7z -si  # or just extract and recompress
```
skilldb get file-formats-skills/RAR Compressed ArchiveFull skill: 165 lines
Paste into your CLAUDE.md or agent config

You are a file format specialist with deep expertise in RAR archives, including RAR5 format internals, solid compression, AES-256 encryption, recovery record configuration, multi-volume splitting, and extraction workflows with unrar and 7-Zip.

RAR Compressed Archive (.rar)

Overview

RAR (Roshal ARchive) is a proprietary compressed archive format created by Eugene Roshal in 1993. It offers better compression ratios than ZIP, strong AES-256 encryption, error recovery records, and multi-volume splitting. RAR is widely used for distributing large files online, particularly in file-sharing communities, gaming, and media distribution.

While the decompression algorithm is open-source (via unrar), creating RAR archives requires licensed software from RARLAB.

Core Philosophy

RAR is a proprietary archive format developed by Alexander Roshal, offering strong compression ratios, robust error recovery, and multi-volume archive splitting. RAR's compression typically falls between ZIP and 7z in effectiveness, but its distinguishing features are recovery records (which can repair damaged archives) and solid archive mode for compressing groups of similar files.

RAR's proprietary nature means the compression algorithm is owned by RARLAB and the encoder is not freely available — WinRAR is shareware, and only decompression libraries (unrar) are freely distributed. This asymmetry (free to decompress, paid to compress) shapes RAR's practical role: it is a common format for distributing content but not an ideal choice for creating archives in open-source or cross-platform workflows.

For new projects, prefer open formats: ZIP for universal compatibility, 7z for maximum compression, or zstd/tar.zst for modern high-performance archiving. Use RAR when you need its specific features (recovery records for unreliable storage or transmission, multi-volume splitting for size-limited upload platforms) or when distributing to audiences that expect RAR format.

Technical Specifications

  • Extension: .rar, .rev (recovery volumes), .r00/.r01 (legacy split)
  • MIME type: application/vnd.rar, application/x-rar-compressed
  • Magic bytes: Rar!\x1A\x07 (RAR 4.x: \x00, RAR 5.0: \x01)
  • Max file size: Practically unlimited (8 EB theoretical)
  • Compression: LZSS + Huffman coding (RAR4), custom algorithm (RAR5)
  • Encryption: AES-256 in CBC mode (RAR5 uses PBKDF2-HMAC-SHA256 key derivation)
  • Current version: RAR 5.0 format (since WinRAR 5.0, 2013)

Internal Structure

RAR5 uses a block-based format:

[Signature Block]
[Archive Header Block]
[File Header Block 1 + Compressed Data 1]
[File Header Block 2 + Compressed Data 2]
...
[Recovery Record Block (optional)]
[End of Archive Block]

RAR supports solid compression where multiple files are compressed as a continuous data stream, significantly improving compression ratio for collections of similar files.

How to Work With It

Creating RAR Archives

# WinRAR command line (requires license)
rar a archive.rar folder/
rar a -m5 archive.rar files/           # maximum compression
rar a -hp archive.rar secret/          # encrypt filenames + content
rar a -rr5p archive.rar data/          # add 5% recovery record
rar a -v100m archive.rar largefile.iso  # split into 100MB volumes
rar a -s archive.rar similar_files/     # solid archive (better ratio)

Extracting

# unrar (free, available on all platforms)
unrar x archive.rar                    # extract with full paths
unrar e archive.rar /target/dir/       # extract flat (no directories)
unrar l archive.rar                    # list contents
unrar t archive.rar                    # test integrity

# 7-Zip can also extract RAR
7z x archive.rar

# Python (using rarfile library, requires unrar binary)
import rarfile
with rarfile.RarFile('archive.rar') as rf:
    rf.extractall('/target/dir')

Recovery

# Repair corrupted archive using recovery record
rar r damaged.rar

# Reconstruct missing volume from .rev files
rar rc archive.part1.rar

Converting to Other Formats

# RAR to ZIP (extract then recompress)
mkdir tmp && cd tmp && unrar x ../archive.rar && zip -r ../archive.zip . && cd .. && rm -rf tmp

# RAR to 7z
7z a -t7z output.7z -so -- . | 7z a output.7z -si  # or just extract and recompress

Common Use Cases

  • Large file distribution: Scene releases, game mods, software distribution
  • Multi-volume archives: Splitting large files for upload to file hosts with size limits
  • Data preservation: Recovery records protect against partial corruption
  • Encrypted storage: Strong AES-256 with optional filename encryption
  • Solid compression: Archiving many similar files (source code, documents)
  • Usenet/newsgroups: Traditional format for binary file distribution with PAR2 recovery

Pros & Cons

Pros

  • Better compression ratio than ZIP, especially with solid archives
  • Recovery records can repair partially corrupted archives
  • Strong AES-256 encryption with optional filename encryption
  • Multi-volume splitting with automatic naming
  • Solid compression dramatically improves ratio for similar files
  • Mature and battle-tested format over 30 years

Cons

  • Proprietary format — creating RAR archives requires licensed WinRAR
  • Cannot create RAR files with free/open-source tools (only extract)
  • Slower compression and decompression than modern alternatives (Zstandard)
  • 7z format achieves comparable or better compression with open-source tools
  • No streaming decompression for solid archives (must process sequentially)
  • Declining relevance as 7z and Zstandard gain adoption

Compatibility

PlatformExtractCreateNotes
WindowsWinRAR, 7-ZipWinRAR (paid)WinRAR is shareware with famous nag screen
macOSThe Unarchiver, Keka, unrarRAR CLI (paid)No native support
Linuxunrar, 7-Ziprar (paid)unrar-free has limitations
AndroidRAR, ZArchiverRAR app (free by RARLAB)
iOSiZip, DocumentsLimited

Programming languages: Python (rarfile, read-only), Node.js (node-unrar-js), Java (junrar). All require the unrar binary or implement read-only access.

Related Formats

  • ZIP — Universal but lower compression ratio
  • 7z — Open-source alternative with comparable/better compression
  • Zstandard — Modern, fast compression (not an archive format by itself)
  • PAR2 — Often paired with RAR for error recovery on Usenet
  • TAR.GZ — Unix/Linux standard archive format

Practical Usage

  • Use solid compression (rar a -s) when archiving many similar files (source code, documents) -- it can improve compression ratio by 20-40% by treating files as a continuous data stream.
  • Always add recovery records (rar a -rr5p) when archiving important data -- a 5% recovery record allows repairing partially corrupted archives without redownloading.
  • Use 7-Zip or unrar for extraction on any platform -- you do not need WinRAR to decompress RAR files.
  • Prefer 7z or tar+zstd over RAR for new archives -- they offer comparable or better compression with fully open-source tools for both creation and extraction.
  • Use multi-volume splitting (rar a -v100m) when distributing large files through upload services with file size limits.
  • Test archive integrity after creation with unrar t archive.rar to verify no corruption occurred during archiving.

Anti-Patterns

  • Creating RAR archives in automated pipelines -- RAR creation requires proprietary licensed software; use 7z, tar+zstd, or ZIP for scriptable, license-free archiving workflows.
  • Using RAR for Linux/Unix software distribution -- The Linux ecosystem expects tar.gz, tar.xz, or .deb/.rpm packages; RAR is non-standard and requires additional tools to extract.
  • Extracting RAR files with rpm -i or low-level tools without dependency resolution -- Use unrar x (preserves paths) rather than unrar e (flattens directory structure) to avoid losing the archive's directory hierarchy.
  • Assuming RAR encryption hides file metadata -- By default, RAR encrypts file contents but not filenames; use the -hp flag (header encryption) to also encrypt the file listing.
  • Choosing RAR over 7z for maximum compression -- 7z with LZMA2 compression achieves comparable or better ratios than RAR with fully open-source tooling for both creation and extraction.

Install this skill directly: skilldb add file-formats-skills

Get CLI access →