How to password-protect a ZIP file on a Mac
Finder can’t add a password to a ZIP. Its Compress command makes an ordinary, unprotected ZIP. There are three ways to get a protected one, and they differ in how strong the protection is and who can open the result.
| Way | Cost | Strength | Who can open it |
|---|---|---|---|
zip -e in Terminal | Free, built in | Weak (old ZipCrypto) | Almost any app, on any system |
| Encrypted disk image | Free, built in | Strong (AES-256) | Macs only |
| AES-256 ZIP | Free tools or Purrchiver’s unlock | Strong (AES-256) | Apps that support AES ZIPs, like 7-Zip, Keka, and Purrchiver |
1. Terminal: zip -e (free, but weak)
cd ~/Desktop
zip -er Archive.zip "My Folder"zip asks for the password twice and makes Archive.zip. It opens almost
anywhere, which is its strength. Its weakness is the encryption: zip -e
uses ZipCrypto, the original ZIP encryption, which has had practical attacks
since 1994. Use it to keep casual eyes out, not for anything sensitive.
2. Disk Utility: an encrypted disk image (free, strong)
- Open Disk Utility (in Applications ▸ Utilities).
- Choose File ▸ New Image ▸ Image from Folder… and pick the folder.
- Set Encryption to 256 bit AES, enter a password, and save.
You get a .dmg that asks for the password when it’s opened. The encryption
is strong and it’s built into macOS, but it only opens on a Mac. To compress
and encrypt a disk image in one step, see Compress a DMG on
macOS.
3. An AES-256 ZIP (strong, opens on Windows with 7-Zip or WinRAR)
ZIP has a second, much stronger kind of encryption: AES-256. Finder and
zip can’t make it, but these can:
Purrchiver: choose ZIP, set encryption to AES-256, and enter a password. Creating encrypted archives is part of the one-time unlock; opening them is always free.
Keka (free from its website, or $6.49 on the Mac App Store), after you turn on its hidden AES-256 ZIP setting. By default it uses the older, weak encryption.
Terminal, with 7-Zip’s command-line version (
brew install sevenzip):7zz a -tzip -mem=AES256 -p Archive.zip "My Folder"-pwith no password after it makes7zzask for one, so it doesn’t end up in your shell history.
Whoever receives it needs an app that supports AES ZIPs: 7-Zip or WinRAR on Windows, or Keka or Purrchiver on a Mac.
File names are still visible
A password-protected ZIP encrypts the contents of each file, not the list of
names. Anyone can list the file names and sizes without the password; they
just can’t open the files.
If the names themselves are private, use a 7z with encrypted file names
instead: Purrchiver does this when you encrypt a 7z, and 7zz does it with
-mhe=on. See Encrypted archives for how each
format compares.
Choosing a password
Use a long passphrase, several random words, rather than a short password. There’s no way to recover a lost one. In Purrchiver, passwords for ZIP and 7z must use plain ASCII characters for now (no accented letters or emoji).