ZIP, RAR, 7Z and TAR explained: how archives differ and how to open any of them

Someone sends you a .7z and your computer shrugs. A download arrives as .tar.gz and unpacking it produces another file rather than a folder. A .tar turns out to be exactly the same size as the files it contains. None of this is arbitrary: archive formats split into two jobs that most people never see separated, and once you know which format does which, the rest follows. This guide explains that split, compares the formats you actually meet, covers encrypted archives and the two safety issues worth knowing about, and shows how to open any of them in the browser with the archive extractor here — no install, and no upload.

Archiving and compressing are two different jobs

Archiving is putting many files into one, preserving names, folder structure, permissions and timestamps. Compressing is making a stream of bytes smaller. Different formats combine them differently, and that single fact explains most of the confusion:

  • TAR archives, and does not compress. A Unix format from the tape era — it concatenates files and metadata into one stream. That is why a bare .tar is the same size as its contents.
  • gzip, bzip2, xz and zstd compress, and do not archive. Each takes one stream and shrinks it. On its own, gzip compresses a single file.
  • .tar.gz is the two combined — archive first, then compress the whole thing. Also written .tgz. The same pattern gives .tar.bz2, .tar.xz and .tar.zst.
  • ZIP, RAR and 7Z do both at once, which is why they feel simpler on Windows and macOS, where the two-step Unix convention never took hold.

That difference has a real consequence. ZIP compresses each file separately, so you can extract one file from the middle of a huge archive instantly — and you lose compression, because similarities between files cannot be exploited. TAR.GZ compresses the whole concatenated stream as one, which compresses much better across many similar files, but extracting the last file means decompressing everything before it. This is called solid compression, and it is the reason a folder of a thousand similar log files is dramatically smaller as .tar.gz than as .zip.

The formats, compared

FormatCompressionOpens everywhere?Best for
ZIPModerate, per fileYes — built into every OSSending files to someone whose setup you do not know
7ZExcellent (LZMA2, solid)Needs 7-Zip or equivalentSqueezing large data as small as it will go
RARVery good, solidExtraction widely available; creation is licensedLegacy exchange; recovery records for damaged media
TARNoneUniversal on UnixPreserving permissions and structure, before compressing
TAR.GZGood, fastUniversal on Unix, common everywhereSource code, backups, anything on Linux or macOS
TAR.XZExcellent, slow to createCommon on UnixDistribution downloads compressed once, downloaded often
TAR.ZSTVery good, very fastNewer; increasingly standardFrequent backups where compression time matters

A note on each of the outliers. RAR is proprietary: the specification is closed, extraction code is published but creation requires licensed software, and that asymmetry is why the world is full of RAR extractors and almost no RAR creators. Its genuinely distinctive feature is recovery records — redundancy stored inside the archive that can repair a corrupted copy, which mattered enormously in the era of splitting archives across floppies and Usenet posts and still matters for physical media.

7Z is the compression champion for most data, thanks to LZMA2 and a large dictionary, and it supports strong encryption including of the file names. The cost is that it is not built into Windows or macOS, so a 7Z sent to a non-technical recipient often bounces back.

Zstandard is the interesting recent arrival: compression close to xz at speeds closer to gzip, with a wide tunable range. It has spread quickly through Linux distributions, package managers and filesystems, and if you are choosing a format for backups made every night, it is usually the best time-versus-size trade available.

Encrypted archives

Password protection on an archive is worth having and easy to get wrong, mostly because “ZIP with a password” means two very different things:

  • ZipCrypto, the original scheme, is broken. With a small amount of known content from inside the archive, it can be defeated quickly. Some tools still default to it for compatibility.
  • AES-256, available in ZIP as an extension and standard in 7Z and RAR5, is strong. With a long random password there is no practical attack. The catch is compatibility: an AES-encrypted ZIP will not open in some built-in extractors, including macOS’s, which frustrates recipients who have never heard of the distinction.

Two more things people assume and should not. First, file names are usually not encrypted— the archive’s directory is readable without the password unless you explicitly enable header encryption, which 7Z and RAR support and ZIP does not. An archive named redundancies-final.7z containing termination-letters/ has already told the story. Second, there is no recovery. A forgotten password on a strong archive is a lost archive; the tools that claim otherwise are guessing passwords, which works only when the password was weak.

If you are choosing one, use a long random password from a generator, send it through a different channel from the file — and if the real requirement is getting a large file to one person, consider not creating an encrypted archive at all: a direct browser-to-browser transfer is encrypted in flight and leaves no copy for anyone to attack later.

Two things to be careful about when extracting

  • Zip bombs. An archive of a few kilobytes can expand to petabytes, using nested layers of highly compressible data. The defence is not to extract untrusted archives on a machine that will fill its disk trying — check the listed sizes before you extract, and be suspicious of a tiny archive claiming enormous contents.
  • Path traversal. Entry names inside an archive are just text, and an entry called ../../etc/cron.d/backdoor will be written there by a naive extractor. Known as Zip Slip, this has affected a long list of libraries. Modern extractors sanitise paths; if you are writing code that unpacks archives, confirm yours does.

Opening one in the browser

The archive extractor here runs the libarchive engine compiled to WebAssembly, which means the same format support the command-line tools have — ZIP, RAR, 7Z, TAR and its compressed variants, plus ISO and CAB — inside a browser tab. Drop an archive in and you get a list of its contents with sizes; download individual files, or repack everything into a ZIP with one click. If the archive is encrypted, it asks for the password and uses it locally.

Three honest limits:

  • Extraction only.It opens archives and does not create them, except for the “download all as ZIP” repack. Creating RAR is licensed, and for the rest your operating system already has a right-click menu.
  • The archive is processed in memory, so multi-gigabyte files are better handled by a desktop tool. Everyday archives are instant.
  • It is only as good as the archive.A truncated download fails here exactly as it would anywhere else — and that is usually the answer when an archive “is corrupt”: compare its size against what the source says it should be before blaming the format.

The reason to do this in a browser rather than uploading to an extraction site is the obvious one. Archives are what people put private things in — tax documents, exports, backups, a folder someone sent you and told you to keep to yourself. Extracting in the page means the contents are never transmitted anywhere.

Choosing, in practice

  • Sending to someone else: ZIP. It opens everywhere with no instructions, and that is worth more than the extra megabytes.
  • Archiving your own data for storage: 7Z or TAR.XZ for the smallest result; TAR.ZST if you will be creating them often.
  • Anything on Linux or macOS where permissions matter: TAR.GZ. ZIP does not carry Unix permissions reliably.
  • Many similar files: a solid format (7Z, RAR, or any TAR variant) rather than ZIP — the difference can be several-fold.
  • Sensitive contents: 7Z with AES-256 and header encryption, a long random password, sent separately.

Do this

  • Remember TAR archives and does not compress; the compression is the second extension.
  • Use ZIP when you do not control what the recipient has; 7Z or TAR.XZ when size matters most.
  • Prefer a solid format for many similar files — per-file compression wastes the similarity.
  • Encrypt with AES-256, never ZipCrypto, and turn on header encryption if the file names are revealing.
  • Generate a long random password, send it through a different channel, and accept that it cannot be recovered.
  • Check listed sizes before extracting anything from a source you do not trust.
  • Compare a “corrupt” archive’s size against the source before concluding the format is at fault.

Frequently asked questions

Why is a .tar file the same size as the files inside it?

Because TAR does not compress anything. It is a container that concatenates files and their metadata into one stream — the archiving half of the job only. Compression is a separate step applied to the whole tar, which is what .tar.gz, .tar.bz2, .tar.xz and .tar.zst are: one archive, then one compressor over the top.

Why can’t my computer open a RAR file?

RAR is a proprietary format. Windows added built-in RAR extraction relatively recently, macOS never has, and the tools that create RAR archives require a licence. Extraction is the free half, which is why extractors are common and RAR creators are not — including the extractor here, which opens RAR files but cannot make them.

Which format compresses best?

7Z usually, by a clear margin on large or repetitive data, because LZMA2 uses a much larger dictionary and 7Z compresses files together rather than one by one. TAR.XZ is comparable. ZIP is the weakest of the common formats but the most universally readable. The right question is usually not “which is smallest” but “what can the recipient open”.

Are password-protected archives actually secure?

It depends entirely on the method. Modern AES-256 encryption in 7Z, RAR5 or an AES ZIP is genuinely strong, and a long random password cannot be brute-forced. The legacy ZipCrypto scheme still used by some ZIP tools is broken and can be defeated in seconds. Also note that most formats encrypt file contents but leave the file names visible unless you explicitly encrypt the header.

I forgot the password to an archive. Can it be recovered?

Not for modern encryption. There is no master key and no backdoor — a strong password on an AES-encrypted archive is unrecoverable, which is the point of it. Recovery tools simply guess passwords, so they only help when the password was weak or you remember most of it.

Tools used in this guide

Every one of these runs in your browser — the files you work on never leave your device.

More everyday guides