Do 7z, RAR and tar Files Have Metadata?

📄 6 min readUpdated November 12, 2026

Yes, all three do, and tar stores the most. Every tar archive we built carried our login name and group name as plain text, next to numeric IDs, permissions and a timestamp for each file. 7z kept names, times and permissions but no owner. RAR can go either way. We measured tar, tar.gz and 7z ourselves. The RAR part comes from documentation and public sample files.

Which archive format stores the most metadata?

tar does. We built archives from the same test folder as our ZIP guide (a note, a .docx and a photo) on a Debian 12 machine, using GNU tar 1.34, gzip 1.12, Python 3.11.2 and 7-Zip 26.02. Then we read the raw headers.

The tar and 7z columns are our measurements. ZIP repeats that guide. RAR comes from RARLAB's RAR 5.0 format note, the rar 7.00 manual page and 13 sample files from the libarchive project's test suite, listed with 7-Zip. "Manual" marks documented behavior we couldn't run.

ZIP7zRARtar and tar.gz
TimestampsModified time always. zip adds UTC and last-opened timesModified time, sub-second. Created and accessed only on requestModified time only in the 6 RAR5 samples. -ts adds the others (manual)Modified time in whole seconds. pax adds last-read and last-changed times
OwnerNumeric IDs with zip's defaults. No namesNone that we could findOptional, via -ow (manual). One sample held names as textNumeric IDs plus user and group names as text
Folder pathsAs typed, full path includedFrom the folder you named down-ep drops them, -ep2 stores full ones (manual)As typed, minus the leading slash
PermissionsYes with zip, Python and 7-ZipYes, Unix permission bitsYes in the Unix-made samplesYes, always
Can the file list be encrypted?NoYes, with -mhe=onYes, with -hp (manual)No encryption of its own

Does a tar file contain your username?

Yes. In all three modern header formats (GNU, ustar and pax), each of the 5 entries had two text fields holding the login name and group name of the account that ran tar. Next to them sat the numeric IDs, 1000 and 1000 here.

Python's tarfile module wrote the same fields. 7-Zip was the exception: asked to write a .tar, it set both IDs to 0 and left both names blank.

What else does tar record?

Permissions, for a start. Our note was set to owner-only (0600) and every tar said so.

The modified time is whole seconds in UTC, with no hint of the packer's time zone. The pax format goes further. It added a last-read and a last-changed time to all 5 entries, each to the nanosecond, and the file grew from 51,200 to 61,440 bytes.

Paths go in as typed. Given the folder's full path, tar put every parent folder in every name, jsmith/Documents/ included. It removed only the leading slash, and -P kept that too.

Links are the sneaky one. We archived a symbolic link pointing at /home/jsmith/Dropbox/clients/acme/2025-return.pdf. The file wasn't in the archive. Its full path was.

Does a .tar.gz add anything on top?

It can. The gzip wrapper has its own header with room for an original file name and a timestamp.

How we made the .tar.gzName in the gzip headerTime in the gzip header
tar -czfNothingZero
gzip file.tarThe .tar's file nameThe .tar's modified time
gzip -n file.tarNothingZero
Python's tarfile module, w:gz modeThe archive's name minus .gzThe second we built it

Renaming doesn't help: we renamed one to holiday-photos.tar.gz, and gzip -dN still restored the old name.

What does a 7z archive store?

Less. By default 7-Zip kept each name, size, modified time and permission bits. 7z l -slt showed no user or group field at all.

The modified time is finer than tar's: 20:26:53.5890000 for our note, seven decimal places. It's kept in UTC. Listed with the clock set to UTC and then Tokyo, the same entry read 09:26:53 and 18:26:53, so you see the reader's clock, not the packer's.

Created and accessed times were absent until we added -mtc=on -mta=on. And given the folder's full path, 7-Zip stored names starting at tax-2025. It took -spf to keep the parents.

A plain -p password doesn't hide the list. 7-Zip printed every name, size and date without asking for it. Only -mhe=on changed that: without the right password, the archive wouldn't open.

What about RAR files?

We didn't create one. That takes RARLAB's own program, which isn't on our machine.

The format note says each file header holds a name, a modified time, attributes and a flag for Windows or Unix. Optional records can add creation and last-access times, the owner's user name, group name and numeric IDs, and link targets.

The samples matched. One had owner records, and the names root, wheel, nobody and nogroup were readable in its raw bytes. All 6 RAR5 samples held a modified time only. Two older-format samples from 2011 held created and accessed times as well.

A sample with only its file data encrypted listed both names, sizes and dates. One with encrypted headers wouldn't open. The manual says -hp encrypts "both file data and headers."

The samples are other people's files, some from 2011. They show what the format can hold, not what today's WinRAR writes by default. We also tested nothing on Windows or a Mac: no WinRAR, no macOS Archive Utility, no bsdtar.

How do you make a cleaner archive?

Each command ran here, and we re-read the result.

CommandWhat the archive held afterward
tar --format=ustar --sort=name --owner=0 --group=0 --numeric-owner --mtime='2026-01-01 00:00:00Z' --mode='u=rwX,go=rX' -cf out.tar tax-2025IDs 0 and 0, empty name fields, one date, files 0644, folders 0755, name order
The same with -cf - tax-2025 | gzip -n > out.tar.gzThe same, in a gzip wrapper with no name and a zero time
7z a -mtm=off -mtr=off out.7z notes.txt letter-to-accountant.docx IMG_4021.jpgThree bare names and sizes. No dates, no permissions
7z a -mhe=on -pPASSWORD out.7z tax-2025Nothing lists without the password

Don't drop --numeric-owner. With --owner=0 --group=0 alone, tar wrote root in both name fields. And files extracted from the dateless .7z took the archive file's own date.

Does cleaning the archive clean the files inside?

No. We extracted 13 test archives, cleaned ones included. All three files matched the originals' SHA-256 hashes every time. The photo still had its GPS position, and the .docx still named its author.

So clean first, pack second. Check photos in the EXIF viewer and strip them with the Image Metadata Remover. Office files and PDFs go through the Document Metadata Remover or the PDF metadata editor. Our Word and PDF metadata guides show what's in each. Before you scan an archive online, read what VirusTotal does with uploads.

Frequently Asked Questions

Do tar files store your username?

Yes. Every tar we built with GNU tar held the login name and group name of the account that made it, plus numeric IDs. Adding --owner=0 --group=0 --numeric-owner left the names empty.

Does a password-protected 7z file hide the file names?

Only if it was made with -mhe=on. With a plain password, 7-Zip listed every name, size and date without it.

Do RAR files have metadata?

Yes. The format stores each file's name, modified time and attributes, with optional records for other times and the owner's user and group name. That's from RARLAB's format note and public samples. We didn't create one.

Does a .tar.gz file store the original file name?

It depends how it was made. tar -czf stored no name and a zero time in the gzip header. Running gzip on a finished .tar stored its name and modified time. gzip -n left both out.

Does putting a photo in a 7z or tar archive remove its EXIF data?

No. Files extracted from 13 test archives matched the originals' SHA-256 hashes, and the photo still had its GPS position. Strip it first, then archive it.

Related Tools