Set a password before sharing your file

To password-protect an Excel file, you open the file, go to File > Info > Protect Workbook, and choose "Encrypt with Password". Excel then asks you to type a password twice. Once you save the file, nobody can open it without entering that exact password. The process takes about two minutes and works the same way in Excel on Windows, Mac, and the web version.

The password you create should be something you can remember but others cannot guess. Excel does not recover forgotten passwords, so if you lose it, the file becomes permanently locked. Write it down somewhere safe if you think you might forget it — a password manager, a locked drawer, or a trusted person who knows to keep it confidential.

Key Takeaways

  • Password protection in Excel encrypts the entire file so it cannot be opened without the correct password.
  • You set the password through File > Info > Protect Workbook > Encrypt with Password, then save the file.
  • Excel has no password recovery tool, so a forgotten password locks the file permanently.
  • The same password works across Windows, Mac, and web versions of Excel.
  • Password protection is different from sheet protection — one locks the whole file, the other locks individual sheets.

Step-by-step: Password-protecting your file in Excel on Windows

Open the Excel file you want to protect. Click the File tab at the top left of the screen. From the menu that appears, click Info. On the right side of the screen, you will see a button labeled "Protect Workbook" with a dropdown arrow next to it. Click that dropdown arrow.

A small menu appears with the option "Encrypt with Password". Click it. A dialog box opens asking you to enter a password. Type your password in the field — it will appear as dots for security. Click OK. Excel asks you to type the password again to confirm you did not make a typo. Type it exactly the same way and click OK again. Now save the file using Ctrl+S or File > Save. The file is now password-protected.

The next time anyone tries to open this file, Excel will show a password prompt before the spreadsheet appears. Without the correct password, the file will not open at all.

Password-protecting your file on Mac

The process on Mac is nearly identical. Open your file and click File in the menu bar at the top. Select "Protect Workbook" from the dropdown. Choose "Encrypt with Password". Type your password in the dialog that appears, then type it again to confirm. Click OK and save the file.

If you are using Excel on a Mac and do not see "Protect Workbook" in the File menu, make sure you are running a recent version of Excel. Older versions may have this option in a different location — check the Tools menu instead.

Password-protecting your file in Excel online

Excel online (the version you access through Microsoft 365 in a web browser) does not have a built-in password encryption feature. If you need to password-protect a file stored in OneDrive or SharePoint, you have two options: read the file to your computer, password-protect it in the desktop version of Excel, then upload it back; or use the sharing settings in OneDrive or SharePoint to control who can view the file.

OneDrive and SharePoint sharing settings let you choose whether people can view, edit, or view-only, and you can set an expiration date for access. This is different from password protection — it controls who can reach the file through the cloud, not whether the file itself is encrypted with a password.

The difference between file password protection and sheet protection

Password-protecting the entire file (what you just learned) locks the file so nobody can open it without the password. Sheet protection is different — it locks individual sheets within a file so people can open the file but cannot edit certain cells or change the sheet structure. You might use sheet protection if you want to share a file with coworkers but prevent them from accidentally changing formulas or deleting important data.

To protect a single sheet instead of the whole file, right-click the sheet tab at the bottom of Excel, choose "Protect Sheet", and set a password. People can still open the file without a password, but they cannot edit that sheet without entering the password you set. You can protect some sheets and leave others unprotected in the same file.

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

When a password-protected Excel file is opened, a dialog box appears when ready asking for the password. The person has three chances to enter the correct password. If they enter it wrong three times, Excel closes and they have to try opening the file again. There is no "forgot password" button — Excel straightforward will not open the file without the exact password.

If the file is shared via email or cloud storage, the password protection travels with the file. The person receiving it will see the password prompt no matter how they open it — on their computer, phone, or web browser. The password does not change based on who is opening it; everyone uses the same password you created.

Changing or removing a password

To change the password on a file you have already protected, open the file (you will need to enter the current password), go to File > Info > Protect Workbook > Encrypt with Password, and enter a new password. Save the file. The old password no longer works; only the new one will open the file.

To remove password protection entirely, open the file, go to File > Info > Protect Workbook > Encrypt with Password, and leave the password field blank. Click OK without typing anything. Save the file. The file is now unprotected and will open without a password prompt.

Frequently Asked Questions

Can I password-protect a file that is already shared with others?

Yes. If you password-protect a file that people already have access to, they will need the password to open it the next time they try. Existing copies they downloaded before you added the password will still open without a password, but any new copies or updates will require it.

What if I forget the password to my own file?

Excel does not have a password recovery feature. A forgotten password locks the file permanently and there is no way to open it. This is why it is important to store your password somewhere safe — a password manager, a written note in a find location, or tell a trusted person who will keep it confidential.

Does password protection work if I save the file as a different format, like CSV or PDF?

No. If you save an Excel file as CSV (comma-separated values), the password protection is lost because CSV is a plain-text format that does not support encryption. PDF files have their own separate password protection system. Always save as .xlsx or .xls if you want to keep Excel password protection.

Can someone crack or bypass an Excel password?

Excel passwords can be cracked with specialized software, especially older Excel files. Password protection is best used to prevent accidental changes or casual access, not to protect highly sensitive data from someone determined to break in. For files containing truly sensitive information, consider additional security measures like storing them in an encrypted folder or using a dedicated file encryption tool.

Does the password work the same way on Excel mobile apps?

Yes. Excel on iPhone, iPad, and Android will prompt for the password when you try to open a protected file. You enter the password the same way you would on a computer. The password you set on desktop Excel works on mobile without any changes.