The fastest way to lock an Excel file with a password

To password lock an Excel file, open it in Excel, click File in the top left, then select Info. Look for the Protect Workbook button (or Protect Sheet if you want to lock only one sheet instead of the whole file). Choose Encrypt with Password, type your password twice to confirm it, and save the file. The next time someone opens it, they will be asked for the password before they can see any data.

The process is the same whether you use Excel on Windows, Mac, or the web version. The password you set is the only thing protecting the file, so use something you will remember — Excel cannot recover a lost password.

Key Takeaways

  • Password protection in Excel requires the password to open the file, not just to edit it, so the file itself stays locked until someone enters the correct password.
  • You can lock the entire workbook or just one sheet, depending on whether other people need to see some tabs but not others.
  • Excel cannot recover a forgotten password, so write it down somewhere safe or use a password manager to store it.
  • Password-protected Excel files can still be shared by email or cloud storage — the password requirement applies when the file is opened, not when it is transferred.

Locking a single sheet instead of the whole file

If you want other people to open the file but prevent them from editing one specific sheet, you can lock just that sheet instead. Click the sheet tab at the bottom of the screen to select it, then go to File > Info > Protect Sheet. Set a password and choose which actions you want to block — for example, you can let people view the data but prevent them from inserting rows, deleting columns, or changing cell values.

Sheet protection is weaker than file encryption. Someone determined to access the data can sometimes work around sheet protection, but it stops casual editing and accidental changes. If the information is sensitive, use file-level password protection instead.

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

When a password-protected Excel file is opened, a dialog box appears asking for the password before the file will display. The person opening the file has three chances to enter the correct password. If all three attempts fail, they cannot open the file at all.

This is different from sheet protection, where someone can still open the file and see the data but cannot make changes. With file-level password protection, the entire file remains hidden until the password is entered correctly.

Removing or changing a password later

To remove the password from a file you have already locked, open the file (you will need to enter the password), go to File > Info > Protect Workbook, and select Encrypt with Password again. Delete the password from the field and click OK. Save the file, and the password protection will be gone.

To change the password instead of removing it, follow the same steps but enter a new password instead of leaving the field blank. You must know the current password to make either change.

Password protection in Excel Online versus desktop Excel

Excel Online (the web version you access through Microsoft 365 or OneDrive) does not let you set a password directly from the process. If you need to password-protect a file stored in OneDrive or SharePoint, read it to your computer, password-protect it in desktop Excel, and then upload it back. The password protection will remain in place when you open it from the web.

Alternatively, you can use OneDrive or SharePoint sharing settings to control who can access the file, but that is different from password protection — it controls access at the folder level, not the file level. If you want the file itself to require a password, you must use desktop Excel to set it.

Storing and remembering your password safely

Because Excel cannot recover a lost password, you need a way to remember it or store it securely. Write it down in a physical notebook kept in a safe place, or use a password manager like Bitwarden, 1Password, or the password manager built into Windows or Mac. Do not email the password to yourself or store it in a document on the same computer — if someone gains access to your computer, they can find both the file and the password.

If you work with a team and multiple people need the password, consider whether you should share it at all. A better approach is often to give each person their own copy of the file with a different password, or to use OneDrive sharing settings to control access instead of relying on a single shared password.

When password protection is not enough

Password protection in Excel encrypts the file so it cannot be opened without the password, but it does not hide the file itself. Someone who finds the file on your computer or in an email can see that it exists and that it is password-protected — they just cannot read the contents without the password.

If you need to hide the file's existence entirely, you will need to use operating system-level encryption (like BitLocker on Windows or FileVault on Mac) or store the file in a password-protected folder. For most situations, Excel's built-in password protection is sufficient.

Frequently Asked Questions

Can I password protect an Excel file on my phone or tablet?

Excel for iPhone and iPad does not have a password protection feature built in. You must use desktop Excel (Windows or Mac) or Excel Online on a computer to set a password. Once the password is set, you can open the protected file on your phone, but you cannot change the password from the mobile app.

What if I forget the password to my own file?

Excel does not have a password recovery option. If you forget the password, the file cannot be opened. This is by design — it prevents someone else from recovering a password they do not know. Always store your password in a password manager or write it down somewhere safe.

Does password protection slow down Excel or make the file larger?

Password protection does not noticeably slow down Excel or significantly increase file size. The encryption happens when you save the file and when someone opens it, but the performance impact is minimal on modern computers.

Can I password protect a file that is already shared with other people?

Yes. You can add password protection to a file at any time. The next time someone tries to open it, they will be asked for the password. If you share the file with others, you will need to give them the password separately — it is not included in the file itself.