Zip files are popular means of storing and sharing files. Personal files are always at the risk of unauthorized access. A password-protected zip file protects your files from prying eyes.
Zip files aren’t the ultimate solution for optimal file security. But password protection is the first line of defense when hackers get their hands on your file. It’s like someone finding a treasure chest but not being able to open it without the proper key.
How To Password Protect A Zip File
Password protecting a zip file depends on the use case that you’re seeking. Whether somebody else has to access the file or it is only you. It also depends on whether you want to install a third-party app or not. Read along to find out how you can password protect a zip file.
Password Protect A Zip File in Windows
Built-in Windows Encryption
This approach works on Enterprise, Education, and Pro versions of Windows. It is not available in the Home version. The good thing about this approach is that you don’t need to involve any third-party apps.
- Navigate to the file/folder and right-click on it.
- Select Send to and select Compressed(Zipped folder).
- You should see a zip file created along with the file/folder.
- Right-click on the zip file and select Properties.
- Under the General tab, select Advanced.
- Under the Compress or Encrypt attributes, check Encrypt contents to secure data. This enables encryption.
- Press OK and select Apply.
- On the Encryption Warning window, select the recommended “Encrypt file and parent folder”.
- Click on OK.
- Select OK to close the Properties window.
Once you encrypt the zip file, it is accessible only if you logged in from the same user who encrypted it. This is why you will see no change when attempting to open the zip file. But, if you log in to your PC using a different user, the file is inaccessible.
One key thing to note here is using this method of password protection secures the file for a single user. It means you cannot share it with anyone else.
This is because the file won’t open on anybody else’s Windows PC. It won’t open on your PC either if you log in under a different username.
Thus this file is now tied into your user account. If you lose access to it, you won’t be able to recover your zip file.
Third-party Apps
Third-party apps are only tied to the passwords they create during compression. Even if you lose access to the user account, you can still recover zip file contents. This also means that if the password is leaked, anyone can open the zip file’s contents. They don’t even need to open the zip file on your PC.
7Zip
- Right-click the file that you want to protect.
- Under 7Zip, Select Add to Archive.
- Make sure the Archive format is set to zip.
- Under encryption, enter the password twice on the displayed fields.
- Select WinCrypto or AES and select OK.
- There are pros and cons to using both AES and ZipCrypto.
- With AES,
- You can open zip files only using 7ZIP, WinZip, and a few other ZIP archivers.
- AES-256 provides stronger encryption.
- With ZipCrypto,
- You can open zip files without any third-party applications in Windows.
- Compatible with all the ZIP compressing software.
- With AES,
WinZip
- Right-click the file that you want to protect.
- Under WinZip, select Add/Move to Zip file.
- Type a name for the compressed file.
- Under encryption, check Encrypt files.
- Click on the arrow next to Encrypt files.
- Select 256 bit AES or Legacy(ZipCrypto) and click OK. Refer to the section above on the pros and cons of both tools.
- Click Add.
- Enter a password twice for verification and select OK.
Password Protect A Zip File in Linux/MacOS
- Open terminal.
- Install zip and unzip application packages.
- For Ubuntu-based and Debian based
sudo apt install zip unzip -y
- For RedHat/Fedora/CentOS
sudo dnf install zip unzip
- For Arch Linux
sudo pacman -S zip unzip
- The above commands are for Linux only. macOS ships with these packages by default.
- For Ubuntu-based and Debian based
- zip -er target_file.zip personal_files
- Replace target_file with target compressed filename and personal_files with source folder or file.
- Enter password and press Enter. Re-enter for confirmation.
Note that the password mentioned in Step 4 is not the same as the root or sudo password for your Linux/Mac OS. It is only a password that you can use to unload the zip file.
After the command completes, the file is now password protected. You should be able to find it in the current working directory.
In case you want to Extract and Install Tar.gz files, we have you covered.
Password Protect A Zip File in MacOS
Using Command Line
For this approach, see the above section on using the zip application package.
Using WinZip
- Download WinZip and install it.
- Once installed, open WinZip from Applications.
- Using Finder, drag and drop the file(s) and folder that needs to be zipped.
- On the right action pane, check Encrypt.
- Select Encryption preferences.
- Under the Encryption method, choose between 256 bit AES or legacy. Refer above section on the pros and cons of both.
- From the top pane, click Add and select from this Mac.
- Enter a password twice for confirmation.
- Go to the required location.
- Select Zip.
Using Keka
- Download Keka and install it.
- Or search and download Keka from the Mac App Store.
- Once installed, open Keka from Applications.
- Make sure you have selected ZIP as shown.
- Choose the compression method or leave it at default.
- Retype password twice for confirmation.
- Check AES 256 or leave it at default for ZipCrypt.
- Using finder, drag and drop file(s) and folders that you want to compress.
- Enter compressed filename and location.
- Select Compress.
Frequently Asked Questions
How to Open a Password-protected Zip File?
To open a zip file, you can either use the graphical method or the command line method. Both methods require you to enter your password for decompression.
Graphical method
You need to have a compression application to open password-protected zip files. You can also use Windows if you don’t have a third-party application.
- Navigate to the zip file location.
- Double click on it to open it.
- You can now view the contents of a zip file without having to enter the password.
- To open a file or extract from it, select extract or double click on it.
- Enter the correct password.
Command-line method
Both Linux and macOS support this method. You need to have file permissions to access the zip file.
- cd Downloads
- To go to the zip file in the Downloads folder.
- unzip compressed_file.zip
- Enter password and press Enter.
- Files are now available at the current location with the same folder name.
How Safe is a Password-protected Zip File?
A password-protected zip file uses the best encryption technology available. This type of protection is generally safe against most hackers. Also, AES-256 is safer than ZipCrypto at the sacrifice of compatibility. That being said, zip files aren’t a 100 percent method of securing file contents.
- You can still delete the password-protected content of a zip file.
- You can still add insecure and malicious code to the content of a zip file.
- You can delete and replace the secure content without entering a password.
Thus, password protection can only go so far as to prevent file contents from direct eyes. It cannot prevent unauthorized modification and deletion.
How Can I Protect My Files From Hackers?
There are many ways of protecting yourself from hackers. For adequate security, use a combination of more than one method from below.