Fixing Damaged ZIP/RAR Files: When WinRAR Fails and CLI Tools Work
A corrupted archive usually announces itself in one of three ways: a CRC mismatch on a specific file, an "unexpected end of archive" error pointing to a truncated header, or a flat refusal to open because the central directory is unreadable. This guide covers what causes each of these, and the specific tools and flags that fix them — including the cases where GUI tools silently fail and you need the command line instead.
Why Archives Break
Before picking a repair method, it helps to know which failure mode you're dealing with, since the fix is different for each.
- Incomplete transfers: If a download or copy is interrupted, the file ends mid-stream. The local file header and data may be fine, but the central directory (stored at the end of a ZIP) is missing or truncated. This is the most common cause of "cannot open file: it does not appear to be a valid archive."
- Bit rot / storage corruption: A handful of bytes flip somewhere in the compressed stream, usually from a failing drive or a bad transfer over an unreliable connection without checksum verification. This produces CRC mismatches on specific files while the archive otherwise opens fine.
- Corrupted headers: The local file header, central directory header, or end-of-central-directory record gets overwritten or misaligned — often from a program crashing mid-write, or from software (some antivirus tools included) rewriting bytes in place.
- Multipart volume mismatches: For split archives (.z01, .z02... or .part1.rar, .part2.rar), a missing or misnamed volume breaks the whole set, even if every individual file is otherwise intact.
Each of these needs a different repair approach, which is why "just run repair" doesn't always work.
Method 1: GUI and Native Repair Tools
WinRAR: Alt+R
WinRAR has a built-in repair function. Select the archive, press Alt+R (or Tools → Repair Archive). It creates a new file prefixed rebuilt_ or fixed_ rather than modifying the original.

This works by scanning the file for valid local file headers (PK\x03\x04 for ZIP, or the RAR5 marker block for .rar) and rebuilding the central directory from what it finds. It's effective for corrupted headers and missing central directories.
Where it falls short: if the actual compressed data stream is damaged — not just the header — WinRAR will often recover the file entry but produce a 0-byte or truncated output for that specific file. It rebuilds structure, not compressed data. If DEFLATE or the RAR compression stream itself is broken, there is nothing to decompress, so you get an empty placeholder instead of a real fix.
7-Zip: Test Archive
7-Zip doesn't have a repair function in the GUI, but its test command is useful as a diagnostic step before you try anything else:
7z t archive.zip

This runs a full CRC check per file and reports exactly which entries fail, rather than a generic "archive is damaged." Run this first — it tells you whether you're dealing with a header problem (test fails immediately, can't even list contents) or a data-stream problem (listing works, specific files fail CRC).
Method 2: Command Line Recovery
zip -FF (fix, aggressive)
The zip utility ships with two repair modes:
zip -F broken.zip --out fixed.zip
zip -FF broken.zip --out fixed.zip
-F handles minor structural issues, assuming the central directory is mostly intact. -FF is more aggressive: it ignores the central directory entirely and does a byte-level scan of the file for the local file header signature PK\x03\x04, then attempts to reconstruct entries from there.
unzip -l fixed.zip
Run this afterward to confirm which files actually made it in. -FF will sometimes recover files under different or truncated names if the original filename bytes were part of the damage.
unrar -kb (keep broken)
For RAR files, unrar has a repair mode:
unrar r broken.rar
This produces a rebuilt.rar in the same way WinRAR's Alt+R does. For extraction of a partially damaged archive without attempting a rebuild first:
unrar x -kb broken.rar
The -kb flag tells unrar to keep broken (incompletely extracted) files instead of deleting them on error. Without it, unrar deletes any file it can't fully extract, which is the wrong default when partial data is better than none.
Method 3: Forced Extraction for Damaged Media
When you know the archive has real data-stream damage — not just a broken header — the goal shifts from "repair" to "extract whatever is recoverable."
7z x archive.zip -aos -o./recovered
-aos tells 7-Zip to skip extracting files that already exist in the output directory rather than prompting or overwriting — useful when you're re-running extraction after a partial success and don't want to lose what already came through cleanly.
For RAR archives with confirmed stream damage:
unrar x -kb -y broken.rar ./recovered/
-y auto-confirms prompts (useful for scripting), -kb keeps the broken output. Expect files that hit the corruption point to be truncated at that byte offset — this is a hard limit of DEFLATE and RAR compression, not a tool limitation. Once a compressed stream desyncs, everything after that point in the same file is unrecoverable without the original data. Files stored after the damaged one in the archive are usually unaffected, since each is compressed independently.
Prevention: Recovery Records
The most reliable fix is not needing repair in the first place. WinRAR supports embedding a recovery record at creation time:
rar a -rr5 archive.rar files/
-rr5 adds redundancy equal to roughly 5% of the archive size (adjustable, e.g. -rr10 for 10%). This works like a lightweight parity system: it can reconstruct small amounts of corrupted data — a handful of flipped or missing bytes — without needing the original source files. It won't recover from large missing chunks (like a transfer that stopped halfway), but it handles the more common case of localized bit rot or minor transmission errors.
ZIP has no native equivalent; if you need this for ZIP-format archives, you'd need to pair them with a separate parity tool (e.g., PAR2) or just standardize on RAR with -rr for anything going over an unreliable connection.
Once your archive is verified clean, generate a direct transfer link via the homepage to send it without transfer corruption.