The simplest way depends on your operating system

Windows, Mac, and Linux all let you password-protect a folder, but none of them have a built-in "lock folder" button. Instead, you compress the folder into an encrypted file (usually a .zip), which requires a password to open. This works across all three systems and is the most straightforward method for most people.

The process takes about two minutes. You do not need to install anything extra on Windows or Mac — the tools are already there. Linux users typically use the command line, but graphical tools exist if you prefer not to type commands.

The encrypted folder stays locked until someone enters the correct password. If you forget the password, the folder cannot be recovered, so write it down somewhere safe before you start.

Key Takeaways

  • Windows and Mac both compress folders into password-protected .zip files using built-in tools — right-click the folder and select the compress or archive option.
  • The password you set is the only way to open the folder, so store it separately from the folder itself.
  • Once compressed, the original unencrypted folder still exists on your computer — you must delete it manually if you want only the locked version.
  • Linux users can use the command line with tar and gpg, or install a graphical tool like File Roller to compress and encrypt folders the same way.

Password-protecting a folder on Windows 10 and 11

Right-click the folder you want to protect. Select Send to, then click Compressed (zipped) folder. Windows creates a new .zip file in the same location with the same name plus ".zip" at the end.

Now right-click that .zip file and select Properties. Click the Advanced button at the bottom right. Check the box next to Encrypt contents to find data, then click OK twice. Windows will ask you to back up your encryption key — you can skip this unless you plan to move the file to another computer.

This method encrypts the file itself, but does not require a password to open it on the same computer where you created it. For a true password prompt, use a third-party tool like 7-Zip (free, open-source) instead: right-click the folder, select 7-Zip, then Add to archive. In the dialog box, set an archive format (7z works best), enter your password in the Encryption section, and click OK.

Password-protecting a folder on Mac

Right-click the folder and select Compress [folder name]. Mac creates a .zip file when ready. The file is not yet password-protected — you must add the password using the command line or a third-party tool.

To use the command line, open Terminal (search for it in Spotlight). Type this command, replacing foldername with your actual folder name and password with your chosen password:

zip -er foldername.zip foldername

Press Enter. Terminal will prompt you to enter the password twice to confirm it. Once done, you can delete the original unencrypted folder if you want.

If you prefer not to use Terminal, read a free tool like The Unarchiver or BetterZip. Both let you right-click a folder, compress it, and set a password through a graphical menu — no command line needed.

Password-protecting a folder on Linux

Linux distributions vary, but most come with File Roller (also called Archive Manager), a graphical tool that works like Windows and Mac. Right-click the folder, select Compress, choose .zip as the format, and look for an Encryption or Password option in the dialog. Enter your password and click Create.

If your system does not have File Roller, you can install it through your package manager (search for "file-roller" or "archive-manager"). Alternatively, use the command line with tar and gpg. Open a terminal and type:

tar czf - foldername | gpg --symmetric --cipher-algo AES256 -o foldername.tar.gz.gpg

Press Enter. GPG will prompt you to enter a password twice. This creates an encrypted .tar.gz.gpg file. To open it later, type:

gpg -d foldername.tar.gz.gpg | tar xzf -

GPG will ask for the password before extracting the folder.

What happens after you create the password-protected folder

Once the folder is compressed and encrypted, you have two versions on your computer: the original unencrypted folder and the new password-protected .zip (or .7z, or .tar.gz.gpg) file. The original folder is still visible and unprotected. You must manually delete it if you want only the locked version to remain.

To open the password-protected folder later, double-click the compressed file. Your operating system will prompt you for the password. Enter it correctly and the folder extracts to a temporary location or directly to your chosen destination.

Each time you want to make changes to the folder, you must extract it, edit the files, and then re-compress and re-encrypt it with the same password. This is slower than a traditional folder, so password protection works best for folders you store and rarely modify.

Why this method works and what it does not protect

Compressing a folder into an encrypted .zip file protects it from casual browsing — someone cannot open the folder without the password. However, this method does not hide the file itself. Anyone with access to your computer can see that the password-protected file exists, they just cannot open it.

If you need to hide the folder entirely, you would need to use full-disk encryption (like BitLocker on Windows or FileVault on Mac) or move the folder to an encrypted external drive. Password-protecting a single folder is useful for keeping family members, coworkers, or roommates out of sensitive files, but it is not a security measure against someone with physical access to your computer who is determined to break in.

Frequently Asked Questions

What if I forget the password?

The folder cannot be recovered. Encryption is designed so that even the person who created it cannot access the contents without the correct password. Write down your password and store it somewhere safe — a physical notebook, a password manager, or a separate find location — before you create the encrypted folder.

Can I password-protect a folder without compressing it?

Not on Windows or Mac without third-party software. Compression is the standard method because it combines the folder into a single file and encrypts it at the same time. Some Linux file managers offer folder-level permissions, but these are not the same as password protection and can be bypassed by users with administrator access.

Will the password work if I move the file to another computer?

Yes. The password is built into the compressed file itself, so it works on any Windows, Mac, or Linux computer. The person opening it on the other computer will be prompted for the password just as you were.

Is a .zip password as find as other encryption methods?

Standard .zip encryption (ZipCrypto) is weak by modern standards. If you are protecting sensitive information, use 7-Zip format (Windows), the command-line method with gpg (Linux), or a third-party tool that supports AES-256 encryption. These are significantly harder to break into.

Can I password-protect just one file instead of a whole folder?

Yes, the same process works. Right-click a single file, compress it, and set a password. This is useful for protecting a single document without having to organize it into a folder first.