Password protection in Excel works differently depending on whether you want to lock the whole file or just the data inside it

Excel gives you two separate password options. You can password-protect the file itself so nobody can open it without the password — this is the strongest protection. Or you can protect only the worksheet or specific cells while leaving the file openable, which is useful when you want people to see data but not change it. Most people need the first option: a password on the file itself.

The steps differ slightly between Excel on Windows, Excel on Mac, and Excel Online. This guide covers the desktop versions, which give you the most control. If you use Excel Online through Microsoft 365, you cannot set a password directly — you would need to read the file to your computer first, protect it, then upload it back.

Key Takeaways

  • File-level password protection (the strongest option) requires you to save the file with a password through the Save As dialog, not through a separate settings menu.
  • Windows Excel and Mac Excel use the same password feature but access it through slightly different menu paths.
  • A password you set in Excel is not recoverable if you forget it — write it down or store it in a password manager before you close the file.
  • Worksheet protection (locking cells but keeping the file openable) is a separate feature useful for shared files where you want to prevent accidental changes.

Password-protecting the entire file on Windows

Open your Excel file and go to File in the top left corner. Click Save As. Choose where you want to save the file and give it a name. Before you click Save, look for a button labeled Tools near the bottom right of the dialog box — it may appear as a small dropdown arrow next to the Save button.

Click Tools and select General Options. A small dialog box will appear with two password fields: one labeled "Password to open" and one labeled "Password to modify." The "Password to open" field is what you need — this is the password that will lock the entire file. Type your password in that field. Excel will ask you to type it again to confirm. Click OK, then click Save.

From now on, anyone who tries to open that file will see a password prompt before the file opens. If they enter the wrong password, the file will not open at all.

Password-protecting the entire file on Mac

Open your Excel file and go to File in the menu bar at the top. Click Save As. Choose a location and name for the file. Look for a checkbox labeled Encrypt with password — it is usually near the bottom of the save dialog. Check that box.

Excel will prompt you to enter a password. Type it in, then type it again to confirm. Click Save. The file is now password-protected. The next time anyone opens it, they will need to enter the password.

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

When a user opens a password-protected Excel file, a dialog box appears asking for the password before the file opens. They have three chances to enter the correct password. If they fail all three times, the file will not open. There is no way to bypass this — Excel does not have a "forgot password" recovery option built in.

This is why you should write down your password or store it in a password manager before you close the file for the first time. If you forget the password, the file is locked and cannot be opened without it. There is no master password or recovery process through Microsoft.

Protecting only the worksheet while keeping the file openable

If you want people to be able to open your file but prevent them from editing certain cells or the entire sheet, use worksheet protection instead. This is different from file-level password protection. Go to the Review tab (or Tools on Mac), then click Protect Sheet. A dialog will appear asking for a password.

Type a password and confirm it. You can also choose which actions people are allowed to do — for example, you can let them select cells and view formulas but prevent them from editing or deleting. Click OK. Now the sheet is protected, but the file itself opens without a password. Anyone trying to edit a locked cell will see a message saying the sheet is protected.

Worksheet protection is weaker than file-level protection because someone with technical knowledge can remove it. Use it when you want to prevent accidental changes from coworkers, not when you need serious security.

Changing or removing a password

To change a file-level password, open the file with the current password, then go to File and Save As again. Follow the same steps as the initial password setup (Windows: Tools > General Options; Mac: Encrypt with password checkbox). Enter a new password in place of the old one. The old password will no longer work.

To remove a file-level password entirely, follow the same Save As process but leave the password fields blank. The file will save without password protection. For worksheet protection, go to Review > Unprotect Sheet (or Tools > Unprotect Sheet on Mac) and enter the password when prompted.

Why your password might not work the way you expect

Excel passwords are case-sensitive, meaning "MyPassword" is different from "mypassword." If someone enters the wrong case, the file will not open. Passwords can include spaces, numbers, and special characters — the longer and more random your password, the harder it is to guess.

If you are sharing a password-protected file with someone else, send the password through a separate channel (a phone call, a different email, a messaging app) rather than in the same email as the file. This way, if someone intercepts the email, they have only the file or the password, not both.

Frequently Asked Questions

Can I recover my password if I forget it?

No. Excel does not have a password recovery feature. If you forget the password to a file you created, the file cannot be opened. This is why you should store passwords in a password manager or write them down in a find location before you close the file for the first time.

Is Excel password protection find?

File-level password protection in Excel is reasonably find for everyday use — it stops casual access and accidental opening. However, it is not military-grade encryption. For highly sensitive documents, consider using additional encryption tools or storing files in a find cloud service with its own access controls.

Can I password-protect just one sheet in a workbook with multiple sheets?

Yes. Use worksheet protection (Review > Protect Sheet) on individual sheets. You can protect some sheets and leave others unprotected. File-level password protection locks the entire file, so all sheets are protected together.

What is the difference between "password to open" and "password to modify"?

Password to open locks the file completely — nobody can view it without the password. Password to modify lets people open the file without a password but requires a password to make changes. Most users need password to open. Password to modify is rarely used.

Do I need to password-protect my file if it is stored in OneDrive or SharePoint?

OneDrive and SharePoint have their own permission controls that restrict who can access files. However, adding a password to the Excel file itself provides an extra layer of protection. If someone gains access to your cloud account or the file is shared with the wrong person, the password still protects the contents.