Password protection in Excel works differently depending on whether you want to lock the entire file or just specific cells

You can password-protect an Excel file in two main ways: lock the whole file so nobody can open it without the password, or lock individual sheets and cells so people can open the file but cannot edit certain parts. Most people want the first option — protecting the file itself. The steps differ slightly between Excel on Windows, Excel on Mac, and Excel Online, and the protection method you choose affects what someone can do if they have the file.

If you only want to prevent accidental changes to certain cells or formulas, you can lock those cells and then protect just the sheet. This lets people view and work with the file but keeps them out of the parts you mark as protected. The trade-off is that sheet protection in Excel is not very strong — someone determined can remove it — but it stops casual editing.

Key Takeaways

  • File-level password protection (Windows and Mac) encrypts the entire file and requires the password to open it at all.
  • Sheet protection lets people open the file but prevents them from editing locked cells, and is weaker but faster to set up.
  • Excel Online does not support file-level passwords, only sheet protection.
  • You must remember your password — Excel cannot recover it if you forget, and the file becomes inaccessible.

Password-protecting the entire file on Windows

To lock the whole file so it cannot be opened without a password, go to File > Info > Protect Workbook > Encrypt with Password. A dialog box will appear asking you to enter a password. Type it in, then click OK. Excel will ask you to type it again to confirm. Once you click OK a second time, the file is encrypted.

The next time anyone tries to open that file, Excel will prompt them for the password before the spreadsheet appears. If they enter the wrong password, the file will not open. This encryption is strong enough that Microsoft cannot recover the file if you forget the password, so write it down somewhere safe or use a password manager.

If you want to remove the password later, go back to File > Info > Protect Workbook > Encrypt with Password, delete the password from the dialog box, and click OK.

Password-protecting the entire file on Mac

On Excel for Mac, the process is similar but the menu path is different. Open the file, then go to Tools > Protect Workbook > Encrypt with Password. Enter your password, click OK, then type it again to confirm. The file is now encrypted.

To remove the password on Mac, return to Tools > Protect Workbook > Encrypt with Password, clear the password field, and click OK.

Protecting individual sheets with a password

If you want people to open the file but prevent them from editing certain sheets or cells, you can protect just the sheet. First, decide which cells should be editable. Select those cells, right-click, choose Format Cells, go to the Protection tab, and uncheck Locked. This marks those cells as unlocked. All other cells on the sheet will remain locked.

Next, go to Tools (Mac) or Review (Windows) > Protect Sheet. A dialog will appear. Enter a password if you want one — you can also protect the sheet without a password, which just prevents accidental changes. Check the boxes next to the actions you want to allow (usually "Select locked cells" and "Select unlocked cells" are already checked). Click OK and confirm the password.

Now anyone who tries to edit a locked cell will see a message saying the sheet is protected. They can still view and work with unlocked cells. If you set a password, they would need that password to unprotect the sheet. Sheet protection in Excel is not cryptographically strong — someone with technical knowledge can remove it — but it is effective for preventing accidental or casual changes.

What you cannot do with Excel Online

Excel Online (the browser version you access through OneDrive or SharePoint) does not support file-level password encryption. You cannot use the Encrypt with Password option in the web version. You can still protect individual sheets using the same steps as the desktop version, but the entire file cannot be password-locked in the browser.

If you need file-level encryption, download the file to your computer, password-protect it in the desktop version of Excel, then upload it back to OneDrive or SharePoint. When someone opens it from the web, they will be prompted for the password.

Choosing between file protection and sheet protection

Use file-level password protection when you want to keep the entire spreadsheet private and prevent anyone from opening it without permission. This is the stronger option and works well for sensitive financial data, personal information, or confidential business files. The downside is that if someone has the password, they can see and edit everything.

Use sheet protection when you want to share the file with people who should see most of it but not edit certain parts — for example, a budget template where people can fill in their numbers but cannot change the formulas. Sheet protection is also useful for preventing accidental deletion of important cells. It is faster to set up and does not require people to enter a password to open the file.

You can use both at the same time: password-protect the file so it cannot be opened without a password, and also protect specific sheets within it so that even someone with the file password cannot edit locked cells.

What happens if you forget the password

If you forget a file-level password, the file is permanently inaccessible. Excel does not have a recovery process, and Microsoft cannot unlock it for you. There are third-party tools that claim to crack Excel passwords, but they work only on older Excel files (before 2007) or on sheet protection, not on modern file-level encryption.

For this reason, store your password in a password manager like Bitwarden, 1Password, or the password manager built into your browser. If you use a simple password you can remember, write it down and keep it in a secure physical location. The few seconds it takes to save the password is worth far more than the risk of losing access to your file.

Frequently Asked Questions

Can someone crack an Excel password?

File-level passwords in modern Excel (2007 and later) use strong encryption and are not practical to crack. Sheet protection is weaker and can be removed with specialized tools, but file encryption cannot be bypassed without the password. If you forget the password, the file is lost.

Does password-protecting an Excel file slow it down?

No. File-level encryption has no noticeable effect on how fast the file opens or saves. Sheet protection also has no performance impact. The only delay is the few seconds it takes to enter the password when you first open an encrypted file.

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

Yes. You can protect individual sheets with different passwords, or protect some sheets and leave others unprotected. Go to Review (Windows) or Tools (Mac) > Protect Sheet for each sheet you want to lock. Each sheet can have its own password or no password at all.

What is the difference between locking cells and protecting the sheet?

Locking cells does nothing by itself — it only takes effect after you protect the sheet. When you protect the sheet, all locked cells become uneditable. Unlocked cells remain editable even after sheet protection is turned on. You must do both steps for sheet protection to work.

Can I share a password-protected Excel file with others?

Yes. If you password-protect the file, you give the password to anyone who needs to open it. If you protect only specific sheets, you can share the file openly and give the sheet password only to people who need to edit those sheets. For sensitive files, use a secure method to share the password — not in an email or chat message.