Skip to content
Calcrivo

Archive Size Calculator

Estimate tar or zip archive output size from source file sizes and compression method.

Inputs

Estimated Archive Size

1.71 GiB

Archive Size (MB)

1,750.51

Estimated Compression Savings

65.0%

Uncompressed tar Size (MB)

5,001.46

tar Header/Padding Overhead (MB)

1.465

Step by step

  1. Values used

    Total Uncompressed Data Size (MB) = 5,000; Number of Files = 2,000; Compression Method = gzip (tar.gz) — ~60-70% typical savings

  2. Archive size

    archive_size = (sum(file_sizes) + file_count × 512 header + padding) × (1 − compression_savings)

  3. Estimated Archive Size

    = 1.71 GiB

  4. Archive Size (MB)

    = 1,750.51

  5. Estimated Compression Savings

    = 65.0

  6. Uncompressed tar Size (MB)

    = 5,001.46

  7. tar Header/Padding Overhead (MB)

    = 1.465

How it works

The tar format prefixes every file with a 512-byte header block and pads file content to 512-byte boundaries, so archiving many small files adds measurable overhead before compression even runs (512 bytes/file header, ~256 bytes/file average padding). After that overhead is added, the chosen compressor's typical savings — gzip and zstd around 60-70%, bzip2 65-75%, xz 70-80% for mixed data — determines the final archive size. xz achieves the best ratio but is markedly slower than zstd, which is often preferred for large backups where speed matters more than the last few percent of savings.

Formula

Archive size

archive_size = (sum(file_sizes) + file_count × 512 header + padding) × (1 − compression_savings)

s_i
size of file i
n
file count
c
compression savings fraction

Frequently Asked Questions

Why is tar overhead noticeable with many small files but not with a few large files?

The 512-byte header cost is per-file, not per-byte, so it scales with file count regardless of size. Archiving 100,000 tiny config files adds roughly 50MB of header overhead alone, while archiving 10 large video files adds only ~5KB — the same total data size produces very different overhead depending on file count.

Which compression method should I use for backups?

zstd is generally the best default for backups: it compresses nearly as well as gzip but several times faster, and supports very fast decompression. Reach for xz when archive size matters more than speed (e.g. long-term cold storage), and reserve bzip2 mainly for compatibility with older tooling.

Does compressing already-compressed files (like JPEGs) inside a tar.gz help?

Barely — media files are already near-incompressible, so wrapping them in tar.gz mainly adds the tar header overhead with little additional compression benefit. Plain tar (no compression) is often just as space-efficient and much faster for archives that are mostly media.

You might also need