What Is a RAR File? Structure, Uses and Limits
Understand what RAR stores, how to identify it and when it is the right format.
Purpose and Design
RAR (Roshal Archive) is a proprietary archive format developed by Eugene Roshal and maintained by RARLAB through the WinRAR application. The format targets high-ratio compression, built-in error recovery, and multi-volume spanning rather than universal compatibility. It is not a system-level container like tar, nor a general interchange format like ZIP.
The format exists in two major versions: RAR 1.50 (legacy) and RAR 5.0 (current). RAR 5.0 archives cannot be opened by decompressors built only for the older version. Compression uses a proprietary LZSS variant with a prediction filter, not LZMA. AES-256 encryption is available as an option.
Reference: https://www.rarlab.com/technote.htm
When RAR Fits the Task
RAR is appropriate when compression efficiency, split-file transport, or recoverability matter more than immediate readability on all platforms.
- Maximum compression on redundant data. Solid archiving mode compresses files as a single stream, yielding 10–40% better ratios than ZIP on text-heavy or repetitive payloads such as database dumps, logs, or raw video.
- Distribution over unreliable channels. Recovery records use Reed-Solomon codes to rebuild damaged bytes up to a configured percentage of the archive. This helps when transferring across email attachment limits or unstable FTP connections.
- Fixed-size volume splitting. RAR can split output into
.part1.rar,.part2.rar(or.part01.rar) segments for file hosts that enforce size caps. Reassembly is automatic when all parts are present. - Password-based AES-256 encryption. RAR 5.0 derives keys via PBKDF2 with 100,000 iterations and encrypts in CBC mode, avoiding the weak schemes found in legacy ZIP encryption.
RAR is the wrong choice when recipients use mobile devices or web browsers that lack native RAR support and cannot install third-party tools. Self-extracting modules are Windows-only; Mac and Linux users cannot execute them without emulation. For long-term archival, the format ties recovery to a single vendor. Alternatives with published specifications—tar.gz, tar.zst, or 7z under the LGPL—avoid that dependency. RAR also stores few standard file attributes: no POSIX permissions, no extended timestamps, and no ACLs. When Unix ownership or macOS resource forks must survive extraction, tar or cpio is required.
Internal Structure
A RAR file is a chain of blocks, each with a header followed by optional data. It is not a flat file list.
Block Types in RAR 5.0
| Block Type | Purpose |
|---|---|
| Main header | Identifies the archive as RAR 5.0. Contains compression method, encryption flag, and recovery record parameters. |
| File header | Per-file metadata: name, uncompressed size, timestamp, compression information, CRC32. |
| Service header | Stores recovery volumes, archive comments, or authentication data. Not user files. |
| End of archive | Marks termination. A missing end-of-archive block indicates truncation or incomplete transfer. |
Solid archiving is the default. All files are compressed together in one data stream. This improves ratio but means extracting a single file requires decompressing every preceding file. Damage inside a solid block can render all subsequent files inaccessible.
MIME Type and Magic Bytes
- MIME type:
application/vnd.rar(registered) orapplication/x-rar-compressed(legacy). - RAR 5.0 signature:
52 61 72 21 1A 07 00(hex). The ASCII portion readsRar!followed by a version byte. - RAR 1.50 signature: Same initial bytes, differing only in the version byte at offset 6.
Compression, Encryption, and Recovery
Compression Modes
RAR provides three compression levels (0–3) plus a store mode. Level 3 is the default. The algorithm uses a dynamic dictionary up to 64 MB in RAR 5.0 and a prediction filter tuned for multimedia data. A text compression filter can reduce ASCII-based files by an additional 5–15%.
Already-compressed formats—JPEG, MP4, ZIP—cannot be compressed further. Attempting to do so wastes CPU time and may increase the output size.
Encryption Implementation
RAR 5.0 encrypts with AES-256 in CBC mode. Key derivation uses PBKDF2 with 100,000 iterations. Encryption is archive-level: the entire payload is opaque until the password is supplied. Browsing filenames or metadata without the password is impossible only when the encrypted header option is enabled. By default, filenames remain in plaintext even when file data is encrypted.
Recovery Records
A recovery record is a Reed-Solomon error-correcting block appended after archive data. It can rebuild damaged bytes up to a configured percentage of the archive size—for example, a 10% recovery record allows reconstruction after losing up to 10% of the file. Recovery fails if damage exceeds the record's capacity or if the main header is destroyed. Recovery records address bit-rot and partial download corruption. They cannot repair logical corruption such as truncation that occurred before compression.
Observable Validation Checks
To identify a RAR file without relying on the extension:
- Read the first 7 bytes with
xxd(Linux),hexdump(macOS), orHxD(Windows). - If bytes 0–6 are
52 61 72 21 1A 07 00, the file is RAR 5.0. - If bytes 0–6 are
52 61 72 21 1A 07 01, the file is RAR 1.50. - If neither signature matches, the file is not a valid RAR archive regardless of its extension.
Files with extensions .rar, .r00–.r99, .partN.rar, or .rev are likely RAR components, but only the hex signature provides certainty.
Hard Limits and Constraints
Volume Splitting
RAR names split volumes .part01.rar, .part02.rar (modern) or .part1.rar, .part2.rar (older style). The volume count is theoretically unlimited, but practical limits apply:
- FAT32 cannot store individual volumes larger than 4 GB.
- Some mobile decompressors fail beyond 255 volumes.
- Recovery volumes (
.revfiles) are limited to 10% of the volume count by default.
Maximum Archive Size
RAR 5.0 supports archives up to 2^63 bytes (8 exabytes). The practical ceiling is the file system's maximum file size—for example, 2^63 on NTFS. Total size across all split volumes cannot exceed 2^63 bytes.
Filename Length
RAR 5.0 stores Unicode filenames up to 260 characters for Windows compatibility or 1024 characters on Unix. Paths longer than 260 characters will fail extraction on Windows unless a tool bypasses the PATH_MAX limit, which most do not.
Compression Ratio Ceiling
Under ideal conditions—large, highly repetitive text—RAR reaches roughly a 1:20 ratio (95% reduction). Binary data typically compresses 1:2 to 1:5. Already-compressed media yields no reduction. RAR does not match specialised compressors such as PAQ or ZPAQ on extreme ratios and trails 7z with LZMA2 on many workloads.
When a RAR File Cannot Be Recovered
Even with recovery records, certain damage is fatal:
- Main header corruption. The first block holds the compression method, encryption status, and file list. Without it, no tool can parse the archive.
- Encrypted payload with header damage. If the archive is encrypted and the header is destroyed, the salt and iteration count needed for key derivation are lost. The password alone cannot decrypt the data.
- Missing recovery record. If no RR was created, any damaged block beyond the first makes the archive partially or wholly unreadable.
- Solid archive damage. A single corrupted byte in a solid block can make all subsequent files inaccessible. Only a recovery record of sufficient size can rebuild the lost data.
RAR's repair function cannot create data that was never present. Backup remains the only reliable fallback for these scenarios.