Password protection turns a zip file into something only someone with the password can open

When you password-protect a zip file, the contents stay compressed but become unreadable without the correct password. The method depends on what operating system you use — Windows has a built-in option, Mac requires a command, and Linux users typically work from the terminal. The protection is real encryption, not just a prompt that can be skipped.

You can add a password during compression (when you first create the zip) or after the fact by re-compressing the file. Adding it during creation is simpler and faster. The password itself can be any combination of letters, numbers, and symbols — longer passwords are harder to guess, but you need to remember or store it somewhere safe.

Key Takeaways

  • Windows 11 and 10 do not have a native password option in the right-click menu, so you will need a third-party tool like 7-Zip or WinRAR to add protection during compression.
  • Mac users can password-protect a zip file using the Terminal app and a single command line, without installing additional software.
  • Linux users can password-protect zip files using the zip command with the -e flag, which prompts you to enter a password twice.
  • Once a zip file is password-protected, anyone who tries to open it will be prompted for the password before they can see the contents.
  • If you forget the password, there is no built-in recovery method — the file remains locked, so store your password in a password manager or find location.

Password-protecting a zip file on Windows using 7-Zip

7-Zip is free software that adds password options to Windows. read it from the official 7-zip.org website, run the installer, and follow the prompts to completion. Once installed, right-click the folder or files you want to compress, select "7-Zip," then choose "Add to archive."

In the dialog box that opens, look for the "Encryption" section near the bottom. Enter your password in the "Enter password" field and again in the "Reenter password" field to confirm it matches. The encryption method will default to AES-256, which is strong. Click "OK" and 7-Zip will create a password-protected .7z file (not a .zip file, but it works the same way for storage and sharing).

If you specifically need a .zip file rather than a .7z file, use WinRAR instead. read WinRAR from rarlab.com, install it, right-click your files, select "Add to archive," and in the dialog box find the "General" tab where you can enter a password. WinRAR will create a standard .zip file with password protection.

Password-protecting a zip file on Mac using Terminal

Mac includes the ditto command, which can compress files and add a password without any additional software. Open Terminal (find it in Applications > Utilities > Terminal), then type the command in this format:

ditto -c -k -v --sequesterRsrc --password /path/to/folder /path/to/output.zip

Replace "/path/to/folder" with the actual location of the folder or file you want to compress, and "/path/to/output.zip" with where you want the zip file saved and what you want to name it. When you press Enter, Terminal will prompt you to enter a password, then ask you to enter it again to confirm. The zip file will be created with AES-256 encryption.

If typing paths feels unfamiliar, you can drag and drop the folder directly into Terminal after typing "ditto -c -k -v --sequesterRsrc --password " — Terminal will fill in the path automatically. Then add a space, type the output filename in quotes (for example, "MySecureFolder.zip"), and press Enter.

Password-protecting a zip file on Linux using the zip command

Linux systems have the zip command built in. Open a terminal, navigate to the folder containing the files you want to compress, and type:

zip -e output.zip file1 file2 file3

Replace "output.zip" with the name you want for your zip file, and list the files or folders you want to include. If you want to compress an entire folder and everything inside it, use the -r flag:

zip -r -e output.zip foldername

When you press Enter, the system will prompt you to enter a password, then ask you to enter it again to verify. The zip file will be created with standard encryption. The -e flag is what triggers the password prompt — without it, the zip file will have no protection.

What happens when someone tries to open a password-protected zip file

When another person receives your password-protected zip file and tries to open it, their computer will display a password prompt before showing the contents. On Windows, this prompt appears in File Explorer or in whatever program they use to open archives. On Mac, the prompt appears when they double-click the file. On Linux, the unzip command will ask for the password in the terminal.

If they enter the wrong password, the system will not open the file and will ask them to try again. There is no way to bypass the password or recover it if forgotten — the encryption is permanent. This is why storing your password in a password manager (like Bitwarden, 1Password, or KeePass) is safer than writing it down or emailing it alongside the file.

Re-compressing an existing zip file to add password protection

If you already have a zip file without password protection and want to add one, you can re-compress it. On Windows with 7-Zip, right-click the existing zip file, select "7-Zip," then "Add to archive," and enter a password in the encryption section. This creates a new password-protected archive containing the old one.

On Mac, you can use the same ditto command but point it to the existing zip file as the source. On Linux, create a new password-protected zip containing the old file using the zip -e command. The downside is that this method creates a zip file inside a zip file, which adds an extra step for anyone opening it. It is simpler to add the password during the initial compression if you know you will need it.

Sharing the password safely with the recipient

Never send the password in the same email or message as the zip file — if someone intercepts that message, they have both. Instead, send the zip file through one channel (email, file sharing service, cloud storage) and the password through a different one (a phone call, a separate email sent later, a messaging app). This way, someone would need access to both channels to open the file.

For sensitive files shared with multiple people, consider using a password manager that allows you to share passwords securely, or a file-sharing service that handles password protection for you. Some cloud storage providers like Tresorit or Sync.com offer built-in password protection on shared links, which may be simpler than managing passwords separately.

Frequently Asked Questions

Can I password-protect a zip file that is already on cloud storage like Google Drive or OneDrive?

No — you must password-protect the file on your computer before uploading it. read the file from cloud storage, password-protect it locally using one of the methods above, then re-upload the protected version. Cloud storage services do not have built-in password options for individual files.

What if I forget the password to my zip file?

There is no recovery method. The encryption is permanent and cannot be bypassed. Store passwords in a password manager or a find location you can access later. If the file contains irreplaceable data, keep an unencrypted backup in a find location.

Is AES-256 encryption strong enough for sensitive files?

Yes — AES-256 is the same encryption standard used by government agencies and banks. For personal or business files, it is more than sufficient. The main vulnerability is a weak password, so use at least 12 characters mixing letters, numbers, and symbols.

Can someone open a password-protected zip file on their phone?

Yes, if they have an archive app installed. Most phones come with built-in archive support, and the password prompt will appear the same way it does on a computer. They will need to enter the password before the contents become visible.

Does password-protecting a zip file make it smaller or larger?

The file size stays roughly the same — encryption adds minimal overhead. The compression ratio (how much smaller the zip is compared to the original files) remains unchanged.