How to Password Protect a Zip File on Windows, Mac and Linux

How to Password Protect a Zip File on Windows, Mac and Linux

Here is how to password protect a zip file in one breath: Windows’ built-in Compressed (zipped) folder can’t add a password, so install a free tool such as 7-Zip and choose AES-256 encryption. On a Mac, one Terminal command does it, or a free app gives you stronger encryption. Pick your computer below, follow the numbered steps, and you’re done in about two minutes.

Before you start, one choice matters more than which button you press: the type of encryption. It decides whether the lock actually holds.

AES-256 or ZipCrypto: which lock are you using?

A password-protected zip can use one of two methods. They look the same to the person opening the file, since both simply ask for a password, but they are very different underneath.

  • ZipCrypto is the original zip encryption from the early 1990s. It has known weaknesses, and free cracking tools can often break it without guessing the password at all, especially when the attacker has a copy of even one file inside. Treat it as a “keep out” sign, not a safe.
  • AES-256 is the modern standard. With a long, random password it is very hard to break. The catch is that not every built-in zip opener understands it.
Method How strong Opens in Windows’ built-in zip? Opens in Mac’s Archive Utility?
ZipCrypto (.zip) Weak: can be cracked Yes, it asks for the password Yes, it asks for the password
AES-256 (.zip) Strong with a good password Often not; some newer Windows 11 versions may, but don’t count on it Usually not; the receiver may need a free app
AES-256 (.7z) Strong, and can hide file names Not reliably; 7-Zip is the safe bet No; needs an app such as Keka

One more thing many people miss: file names inside an encrypted .zip stay visible. Anyone can open the archive and see a list like tax-return-2026.pdf or passport-scan.jpg, even without the password. Only the contents are locked. If the names themselves give too much away, use the 7z format with Encrypt file names ticked, which hides the list until the password is entered.

So the rule of thumb: use AES-256 whenever the receiver can install a free tool, and use ZipCrypto only for low-stakes files where convenience wins.

Windows: password protect a zip file with 7-Zip

7-Zip is free, open source and has been around for more than two decades. Download it only from its official website, then:

  1. Right-click the file or folder you want to protect.
  2. On Windows 11, click Show more options if you don’t see 7-Zip straight away (recent 7-Zip versions may appear in the short menu too).
  3. Choose 7-Zip > Add to archive…
  4. Under Archive format, pick zip (opens more widely) or 7z (stronger, hides file names).
  5. In the Encryption box, type your password in Enter password and again in Reenter password.
  6. For zip, set Encryption method to AES-256 (the default may be ZipCrypto). For 7z, AES-256 is the only choice; tick Encrypt file names as well.
  7. Click OK. The new archive appears next to the original.
  8. Test it: open the archive and check that it asks for the password. Then delete the unprotected original if you no longer need it.

Other tools such as WinRAR or PeaZip work in a similar way. Whatever you use, look for the encryption method setting and choose AES.

Mac: one Terminal command, or a free app

Finder’s Compress option has no password setting, just like Windows. You have two easy routes.

Route 1: Terminal (built in)

  1. Open Terminal from Applications > Utilities, or search for it with Spotlight.
  2. Type cd (with a space after it), drag the folder that holds your files into the window, and press Return.
  3. Type zip -er archive.zip foldername, replacing foldername with the name of the folder to protect, and press Return. The e means encrypt and the r includes everything inside the folder.
  4. Enter a password when asked, then enter it again. Nothing shows on screen while you type; that’s normal.
  5. Find archive.zip in the same folder and double-click it to check it asks for the password.

Keep in mind that this built-in command uses the older ZipCrypto method. It’s fine for keeping casual eyes out, but not for anything truly sensitive.

Route 2: a free app for AES-256

Apps such as Keka can make AES-256 zip or 7z files on a Mac. Keka is free from its own website (the Mac App Store version is paid, to support the developer), though details can change. Set a password in the app’s window, choose zip or 7z, and drop your files in.

If the files will only ever be opened on Macs, there’s also Disk Utility: File > New Image > Image from Folder, then choose 256-bit AES encryption. That makes an encrypted disk image instead of a zip, and it hides file names too.

Linux: quick version

Most distributions include the same zip tool as the Mac, so zip -er archive.zip foldername works, with the same ZipCrypto limits. For AES-256, install the 7-Zip command-line package your distribution offers and run 7z a -p -mhe=on archive.7z foldername. The -p asks for a password and -mhe=on hides the file names. Graphical archive managers such as File Roller or Ark also offer a password field when you create an archive.

Sending it? Never put the password in the same email. If one inbox gets hacked or one message lands with the wrong person, a zip and its password travelling together give everything away. Send the file one way and the password another: a text message, a phone call, a different chat app, or a one-time share link from a password manager that stops working after it’s opened. Agree on the password in person ahead of time if you swap files with the same person often.

Pick a strong passphrase, then keep it somewhere safe

Encryption is only as good as the password behind it. Someone who gets hold of your zip can try billions of guesses offline, with no lockout to slow them down. A short password or a word with a number tacked on falls quickly.

  • Go long. Aim for 15 characters or more, or a passphrase of four or five random words, such as orbit-velvet-cactus-lantern-hum. Length beats clever symbols, which is also what the NIST password guidelines recommend.
  • Make it random. Song lyrics, pet names and birthdays are among the first things cracking tools try. A password generator does this better than any human.
  • Make it unique. Don’t reuse your email or bank password for an archive you send to other people.

Then comes the part everyone forgets: you need to remember it months later. There is no “forgot password” button on a zip file. A password manager solves this neatly. In PassHulk you can generate a random passphrase, save it as a secure note next to a description of the archive, and share it with another PassHulk user or through a one-time link that expires. Everything is encrypted on your device before it’s stored, so not even PassHulk can read it. You can see how that works on the PassHulk features page.

Questions people ask

What if I forgot the password to my zip file?

Nobody can reset it for you, because the password is the key itself. For an AES-256 archive with a long, random password, the files are effectively gone. For a ZipCrypto archive or a short password, recovery tools sometimes succeed by guessing, but only use them on your own files. Check your password manager, old notes and the message you sent the file with first.

Can I add a password to an existing zip file?

Not directly in most tools. The simple way is to unzip it, then create a new password-protected archive from the extracted files, as in the steps above. In 7-Zip you can also open the old zip, extract it, and repack it with AES-256. Delete the unprotected copy afterwards.

Is a password-protected zip file safe to send by email?

It can be, if three things hold: it uses AES-256, the password is long and random, and you send the password by a different route. Remember that file names stay readable in a .zip, and some email services block or flag encrypted attachments because they can’t scan them for malware. For very sensitive files, a 7z with hidden file names or a secure file-sharing service with expiring links is a better fit.

Don’t wait for the next leak. Get every password protected.

PassHulk creates a strong, unique password for every account, fills it in for you, and warns you when one turns up in a breach.

Start free trial
15 days freeNo card neededNothing charged when it ends