How to Password Protect a Zip File

Add a password to your zip files to keep sensitive data secure. Here's how to create encrypted zip archives on every platform.

Important: The built-in zip tools in Windows and macOS Finder do not support password protection. You'll need a third-party tool (free options available) or Terminal commands.

Windows: Using 7-Zip (Free)

1

Download and install 7-Zip

Download 7-Zip from 7-zip.org and install it. It's free and open-source.

2

Select files and open 7-Zip

Select the files you want to protect in File Explorer. Right-click, choose 7-Zip (or Show more options > 7-Zip on Windows 11), then click "Add to archive...".

7-Zip Add to archive option in Windows context menu

7-Zip Add to archive option in Windows context menu
3

Set archive format and encryption

In the archive dialog:

  • Set Archive format to zip
  • In the Encryption section, enter your password twice
  • Set Encryption method to AES-256 for strongest security

7-Zip archive dialog with password and AES-256 encryption

7-Zip archive dialog with password and AES-256 encryption
4

Click OK to create the encrypted zip

Click OK. Your password-protected zip file is created. Anyone who tries to open it will need to enter the password.

Windows: Using WinRAR

1

Select files and open WinRAR

Select your files, right-click, and choose "Add to archive..." from the WinRAR menu.

2

Click Set Password

In the archive dialog, select ZIP as the format, then click the "Set password..." button.

3

Enter your password

Type your password twice and check "Encrypt file names" if you want to hide even the file names inside the archive. Click OK, then OK again.

Mac: Using Terminal

macOS's Finder "Compress" feature does not support passwords. Use Terminal instead.

1

Open Terminal

Open Terminal from Applications > Utilities, or press Cmd+Space and search for "Terminal".

2

Use the zip -e command

# Password-protect a single file

zip -e protected.zip secret-file.txt


# Password-protect a folder

zip -er protected.zip SecretFolder/

You'll be prompted to enter and verify your password.

Alternative: Keka (free macOS app) also supports password-protected zip creation with a GUI interface.

Linux: Using Terminal

# Install zip if needed

sudo apt install zip


# Create a password-protected zip file

zip -e protected.zip file1.txt file2.txt


# Password-protect a folder

zip -er protected.zip my-folder/


# For stronger encryption, use 7-Zip

7z a -tzip -p -mem=AES256 protected.zip file1.txt

Encryption Types Explained

Method Security Compatibility Recommendation
ZipCrypto Weak Universal Only if recipients can't handle AES
AES-256 Strong Most modern tools Recommended

ZipCrypto is the legacy encryption method. It's supported everywhere but is considered insecure—it can be cracked with readily available tools.

AES-256 is modern, military-grade encryption. It's supported by 7-Zip, WinRAR, Keka, and most modern zip tools. Always choose AES-256 when available.

Creating a Strong Password

  • Length matters most: Use at least 12 characters. Longer is better.
  • Mix it up: Combine uppercase, lowercase, numbers, and symbols.
  • Avoid personal info: Don't use names, birthdays, or common words.
  • Use a passphrase: A random phrase like "correct-horse-battery-staple" is both strong and memorable.
  • Share passwords separately: Never send the password in the same email as the zip file. Use a different channel (text message, phone call, etc.).

Last updated: March 2026