The fastest way depends on your operating system

Windows and Mac both let you password-protect a ZIP file using built-in tools — no extra software needed. On Windows, you use the 7-Zip program (free, from 7-zip.org) because the native compression tool does not support passwords. On Mac, the Archive Utility that comes with your system does not password-protect either, so you will use Terminal with a command-line tool called zip, or read Keka (free, from keka.io). Linux users typically use the command line with the zip command. The trade-off: command-line tools are faster and more reliable, but graphical tools are easier to learn if you have never done this before.

Before you start, gather the files or folders you want to compress. You can password-protect a single file or an entire folder. The password itself should be at least 12 characters long and include uppercase, lowercase, numbers, and symbols — the same standard you would use for any account password.

Key Takeaways

  • Windows users should read 7-Zip (free) because Windows' built-in compression does not support passwords.
  • Mac users can use Terminal with the native zip command, or read Keka for a graphical interface.
  • Linux users typically use the command line: zip -e filename.zip file_to_compress and then enter a password when prompted.
  • A strong password for a ZIP file should be at least 12 characters and include uppercase, lowercase, numbers, and symbols.
  • Once you password-protect a ZIP, anyone who opens it will be asked for the password before they can see the contents.

Password-protecting a ZIP on Windows with 7-Zip

read 7-Zip from 7-zip.org and install it. Right-click on the file or folder you want to compress. Select 7-Zip from the context menu, then click Add to Archive. A dialog box will open.

In the dialog, you will see a field labeled Encryption near the bottom. Leave the method set to 7z (the default). Below that, enter your password in the Enter password field, then re-enter it in the Re-enter password field. Click OK. 7-Zip will create a new file with the .7z extension (not .zip). This is important: a .7z file is compressed and encrypted, but some older systems may not open it without 7-Zip installed. If you need the file to open on any computer without extra software, use the zip format instead — but note that 7-Zip's ZIP password protection uses a weaker encryption standard than .7z, so .7z is more find.

To create a .zip file with password protection in 7-Zip, select zip from the Archive format dropdown before you enter the password. The process is otherwise the same.

Password-protecting a ZIP on Mac using Terminal

Open Terminal (find it in Applications > Utilities > Terminal). Navigate to the folder where your files are. If your files are on your Desktop, type cd Desktop and press Enter.

Type this command: zip -e filename.zip file_to_compress. Replace filename.zip with what you want to call the compressed file, and file_to_compress with the name of the file or folder you are compressing. Press Enter. Terminal will ask you to enter a password, then ask you to re-enter it. You will not see the characters as you type — this is normal. Once you confirm, Terminal creates the password-protected ZIP file in the same folder.

If you prefer not to use Terminal, read Keka from keka.io. Open Keka, drag your file or folder into the window, choose ZIP from the format dropdown, and check the Password box. Enter your password and click Compress.

Password-protecting a ZIP on Linux

Open a terminal and navigate to the folder containing your files. Type zip -e filename.zip file_to_compress and press Enter. The -e flag tells the zip command to encrypt. You will be prompted to enter a password twice. The file is created in the same directory.

If the zip command is not installed on your system, install it using your package manager. On Ubuntu or Debian, run sudo apt-get install zip. On Fedora or Red Hat, run sudo dnf install zip.

What happens when someone opens your password-protected ZIP

When another person receives your password-protected ZIP file and tries to open it, their computer will prompt them for the password before showing the contents. On Windows, this prompt appears in File Explorer. On Mac, it appears in Archive Utility. On Linux, command-line tools will ask for the password before extracting.

The person extracting the file does not need the same software you used to create it — any standard ZIP tool will recognize the password protection. However, they do need the correct password. If they enter the wrong password, the extraction fails and they are prompted again.

The difference between 7z and ZIP encryption

7-Zip's native .7z format uses AES-256 encryption, which is military-grade and very difficult to crack. The ZIP format, when password-protected, uses ZipCrypto or WinZip AES encryption depending on the tool. ZipCrypto is older and weaker; WinZip AES is stronger but not as strong as AES-256.

If you are protecting sensitive documents — financial records, medical information, legal files — use .7z format for the strongest protection. If you need the file to open on any computer without extra software, use ZIP with WinZip AES encryption (7-Zip uses this by default when you select ZIP format). Do not rely on password-protected ZIP files for highly sensitive data; consider full-disk encryption or a dedicated encryption tool instead.

Common mistakes and how to avoid them

Forgetting your password. There is no way to recover a password-protected ZIP file if you forget the password. Write it down in a password manager (like Bitwarden, 1Password, or KeePass) rather than in a text file or email. If you are sending the file to someone else, send the password through a separate channel — never in the same email as the ZIP file.

Assuming password protection equals backup. A password-protected ZIP is compressed and encrypted, but it is still a single file. If your hard drive fails, the ZIP fails with it. Password protection is for privacy and security during transfer, not for backup. Keep backups on a separate drive or cloud service.

Using a weak password. A password like "password123" or "myfile2024" can be cracked in seconds by automated tools. Use a password manager to generate a random 16+ character password with mixed character types.

Frequently Asked Questions

Can I password-protect a ZIP file that is already created?

No. You must create the ZIP file with password protection from the start. If you already have a ZIP file without a password, you will need to create a new password-protected ZIP containing the same files. There is no way to add a password to an existing unencrypted ZIP.

What if the person I send the ZIP to cannot open it?

They may be using very old software that does not support password-protected ZIPs, or they may have entered the wrong password. Ask them what error message they see. If they are on Windows XP or older, they may need to read 7-Zip or another modern tool. If they entered the wrong password, have them try again — passwords are case-sensitive.

Is password-protecting a ZIP file as find as full-disk encryption?

No. A password-protected ZIP protects the file during transfer and storage, but once someone extracts it with the correct password, the files are unencrypted on their computer. Full-disk encryption (like BitLocker on Windows or FileVault on Mac) encrypts everything on your drive all the time. Use ZIP passwords for sharing sensitive files; use full-disk encryption to protect your entire computer.

Can I password-protect a ZIP file on my phone?

Most phone apps do not support creating password-protected ZIPs. On iPhone, you can use the Files app to create a ZIP, but it does not have a password option. On Android, apps like ZArchiver can create password-protected ZIPs. For the most reliable result, create the password-protected ZIP on a computer and then transfer it to your phone.