Remove __MACOSX, .DS_Store and ._ files from a ZIP by rebuilding the archive without those entries; you do not need to unzip it first. FindUtils Clean ZIP opens the ZIP in your browser, drops the __MACOSX folder, .DS_Store, AppleDouble ._ files, Thumbs.db and desktop.ini, lists every entry it removed, and saves a cleaned copy. The archive is not uploaded.
This guide explains what each of those files is, where they come from, when to keep them, and how to do the same job from the command line.
What Are the Junk Files in a ZIP?
The junk files in a ZIP are metadata that macOS and Windows write for their own file managers. They are ordinary archive entries with recognisable names, which is why they can be removed without touching the files you meant to send.
| Entry | Written by | What it holds | Safe to remove? |
|---|---|---|---|
__MACOSX/ | macOS Compress and ditto --sequesterRsrc | AppleDouble copies of each file's resource fork and extended attributes | Yes, unless a Mac user needs Finder tags or resource forks |
.DS_Store | macOS Finder | How Finder displayed the folder: icon positions, view style | Yes |
._name | macOS, when writing to disks or shares that cannot store Mac metadata | The metadata of the file called name | Yes, with the same exception as __MACOSX |
Thumbs.db | Windows File Explorer | A cache of image thumbnails for the folder | Yes |
desktop.ini | Windows File Explorer | The folder's custom icon, display name or view settings | Yes |
Why Does a Mac ZIP Contain a __MACOSX Folder?
A Mac ZIP contains a __MACOSX folder because Finder's Compress command stores Mac-only metadata in it. The ditto manual page describes the equivalent command, ditto -c -k --sequesterRsrc --keepParent, as creating an archive "similarly to the Finder's Compress functionality", and says --sequesterRsrc preserves resource forks and HFS metadata "in the subdirectory __MACOSX".
We compressed a folder holding one 3-byte text file, a.txt, with one extended attribute and a .DS_Store, using that command on macOS. The archive listed seven entries:
folder/ folder/.DS_Store __MACOSX/ __MACOSX/folder/ __MACOSX/folder/._.DS_Store folder/a.txt __MACOSX/folder/._a.txt
Only folder/ and folder/a.txt are the content. The 3-byte text file came with a 204-byte ._a.txt metadata file. Running ditto -c -k without --sequesterRsrc put the same ._ files next to each file instead of in __MACOSX, which is why a cleaner has to look for both.
A Mac unpacking the archive reads that metadata back silently. Windows, Linux, build servers and upload validators see a __MACOSX folder full of files that start with ._.
How to Clean a ZIP Without Unzipping It
- Open Clean ZIP. The five junk types are switched on; switch off any you want to keep.
- Drop the
.zipfile on the page, or click to choose it. - Read the summary: entries removed, files kept, and the size before and after. The removed entries are grouped by type, and Copy paths copies the list.
- Click Download to save the cleaned copy, named after the original with
-cleanadded, such asproject-clean.zip.
Cleaning the seven-entry archive above leaves folder/ and folder/a.txt. If an archive has no junk, Clean ZIP says so and offers no download, because the copy would be identical.
What Does Clean ZIP Keep and Refuse?
Clean ZIP keeps every entry that is not junk, with its path, modification date and permissions. Entries already compressed with DEFLATE are copied without being compressed again, and stored entries stay stored, so the files you keep are not re-encoded.
Names are matched exactly. An entry named DS_Store.txt or _notes.md is kept; only .DS_Store, names starting with ._, any path inside a __MACOSX folder, and Thumbs.db or desktop.ini in any letter case are removed. Also remove folders left empty drops folders that the cleaning emptied, while a folder that was already empty in the original stays.
Clean ZIP refuses four kinds of input rather than guessing:
- Password-protected ZIPs. Encrypted entries cannot be read without the password, so nothing is changed.
- Unsafe paths. An entry whose path climbs out of the extraction folder with
.., or starts at the root, is the pattern behind zip slip attacks. The archive is not rebuilt and the paths are listed. - RAR and 7z archives. They are different formats and are not read.
- Archives larger than 1 GB. The whole file is held in the tab's memory.
When Should You Keep the Mac Metadata?
Keep the original archive when the recipient uses a Mac and needs what the metadata carries: Finder tags and comments, resource forks in older Mac files, or extended attributes that an app relies on. Removing __MACOSX and ._ files discards those for everyone who extracts the cleaned copy. For code, documents, images and other plain files sent to Windows or Linux, nothing is lost.
Command-Line Equivalents
| Task | Command | Note |
|---|---|---|
| Delete junk from an existing ZIP | zip -d archive.zip "__MACOSX/*" "*.DS_Store" | Edits the archive in place; add more patterns for ._*, Thumbs.db and desktop.ini |
Create a ZIP without .DS_Store on a Mac | zip -r archive.zip folder -x "*.DS_Store" | The command-line zip does not add a __MACOSX folder |
| See what is inside first | unzip -l archive.zip | Lists every entry, including hidden ones |
We ran the first command on the test archive above and it removed the same five entries Clean ZIP removes. The commands are the right choice in a script or a build step; Clean ZIP needs no terminal, handles all five junk types in one pass, and shows the removed paths before you download.
Common Mistakes
Deleting only __MACOSX. Archives made with ditto -c -k, or zipped from a folder that a Mac copied to a FAT or exFAT drive, keep ._ files beside the real files, outside any __MACOSX folder.
Cleaning the only copy of a Mac project. Keep the original if anyone on a Mac might need its tags or resource forks.
Expecting a smaller archive. The junk entries are usually small. Cleaning removes clutter; it does not compress your photos or PDFs further.
Tools Used in This Guide
| Tool | Use |
|---|---|
| Clean ZIP | Remove __MACOSX, .DS_Store, ._ files, Thumbs.db and desktop.ini from a ZIP |
| EXIF Remover | Strip location and camera data from photos before sharing them |
| Plist JSON Converter | Read Mac property list files you find inside an archive |
FAQ
Is it safe to delete .DS_Store files?
Yes. A .DS_Store file only records how Finder displayed a folder, such as icon positions and the view style. Finder writes a new one the next time the folder is opened, and no other app needs it.
Why do I see ._ files after unzipping on Windows?
macOS stored each file's metadata in a matching ._ file, either inside __MACOSX or next to the file. Windows does not use that metadata, so it shows the ._ files as ordinary files. They can be deleted, or removed from the archive with Clean ZIP before sending it.
Does Clean ZIP change the files I keep?
No. The kept entries keep their paths, dates and permissions, and compressed entries are copied without being compressed again.
Is the archive uploaded?
No. The ZIP is read, filtered and rebuilt by JavaScript in your browser tab, and the cleaned copy is saved from memory.
Sources
ditto(1)manual page on macOS, the--sequesterRsrcoption and the Finder Compress example.- PKWARE, APPNOTE.TXT: .ZIP File Format Specification.
- Apple Support, Zip and unzip files and folders on Mac.
- Snyk, Zip Slip Vulnerability.
Next Steps
Clean an archive with Clean ZIP. If the ZIP holds Windows .url shortcuts, list their links with Internet Shortcuts to CSV.