Show Compression Ratio with Unrar Command

This article explains how to determine the exact compression ratio of files stored within a RAR archive using the command-line utility unrar. By utilizing specific listing flags, you can inspect the uncompressed size, compressed (packed) size, and the resulting compression ratio for individual files as well as the entire archive.

To display the compression ratio of files within a RAR archive, use the verbose list command:

unrar v archive.rar

Alternatively, the standard list command also displays this information:

unrar l archive.rar

Understanding the Output

When you run unrar v archive.rar, the command outputs a tabular view of the archive contents containing several columns:

  • Attributes: File permissions and file system flags.
  • Size: The uncompressed size of the file in bytes.
  • Packed: The compressed size of the file as stored inside the archive.
  • Ratio: The compression ratio shown as a percentage (calculated as Packed Size / Uncompressed Size * 100).
  • Date & Time: File modification timestamps.
  • Checksum: CRC32 checksum of the file.
  • Name: The relative file path.

At the bottom of the output table, unrar prints a summary line showing the total uncompressed size, total packed size, and the overall compression ratio for the entire archive.

Viewing Detailed Technical Information

If you require a detailed per-file breakdown rather than a table, use the technical list command:

unrar lt archive.rar

This command outputs a block of metadata for each archived item, explicitly stating the original size, packed size, and exact compression ratio on individual lines, making it ideal for automated parsing and scripting.