If a spreadsheet holds payroll figures, client details or anything else private, you may want to password protect an Excel file so that nobody can open it without the password. Excel can do this with built-in encryption, but there are several kinds of protection and they are easy to mix up. This guide explains how to password protect an Excel file on Windows, Mac and the web, how that differs from sheet and workbook protection, and how to avoid locking yourself out.

Three types of protection in Excel
Microsoft separates protecting a file, protecting a workbook and protecting a worksheet, and they do different jobs.
| Type | What it does | Where to find it |
|---|---|---|
| File encryption (password to open) | Stops people opening the file without the password | File, Info, Protect Workbook, Encrypt with Password |
| Workbook structure protection | Prevents others adding, moving, deleting, hiding or renaming worksheets | Review tab, Protect Workbook |
| Worksheet protection | Locks cells so they cannot be edited | Review tab, Protect Sheet |
Only the first type controls who can open the file. The other two limit changes and are not a substitute for encryption.
How to password protect an Excel file on Windows
- Open the workbook you want to protect.
- Select File, then Info.
- Select Protect Workbook and choose Encrypt with Password.
- Type a password in the Password box and select OK.
- Type the password again in the Reenter Password box and select OK.
- Save the file.
The next time anyone opens the file, Excel asks for the password. These steps follow Microsoft’s instructions for recent versions of Excel, and the wording can vary slightly between versions.
How to password protect an Excel file on a Mac
In Excel for Mac, Microsoft’s instructions point to the File menu and Passwords. There you can add a Password to open and a Password to modify, select OK, re-enter each password when asked and then save the file. Menu labels can differ between versions of Excel for Mac, so look for the Passwords option or the encryption option under Protect if it is not where you expect.
Can you password protect an Excel file in Excel for the web?
Not fully. Microsoft says that in Excel for the web you can set a workbook to open in read-only mode, but encrypting a workbook with a password is not currently possible there. To encrypt the file, open it in the desktop app by selecting Editing and then Open in Desktop App, and follow the steps above. If you do not have the desktop app, a Microsoft 365 plan includes it.
Password to open or password to modify?
On Windows you can also set passwords from the Save As window by choosing Tools and then General Options. A password to open is the one that encrypts the file and stops it being opened. A password to modify lets people open the file read-only without the password. Modify passwords restrict editing but do not encrypt your data, so treat them as a convenience rather than as security.
More in Tech
How to change or remove the password
Open the file using the current password, then go to File, Info, Protect Workbook and Encrypt with Password again. To remove the password, clear the contents of the password box and select OK. To change it, type a new password instead. Save the file afterwards so the change takes effect.

What if you forget the password?
Plan for this before you encrypt anything. IT guidance from universities, including the University of Wisconsin, warns that if you lose or forget the password it cannot be recovered and the encrypted data cannot be opened without it. We do not recommend password-recovery tools, because their results are unreliable and downloading them can put your computer at risk. Instead, keep the password somewhere safe and keep an unprotected backup of the file in a secure place.
Tips for safer password protection
- Use a long, unique password: a passphrase of several unrelated words is easier to remember than random characters. Our guide to password managers explains how to store passwords safely.
- Keep a backup: if the only copy of an encrypted file becomes corrupted, you lose the data. Follow the 3-2-1 backup rule to protect important files.
- Share the password separately: do not send it in the same email as the file.
- Do not rely on a password alone: Microsoft points out that locking a file with a password does not necessarily protect it from malicious intent, and passwords can still fall into the wrong hands.
- Follow your organisation’s rules: for personal data about customers or staff, check your data protection policy. This article is general information, not security or legal advice.
Related Excel guides
Once your file is safe, you might like our guides to removing duplicates in Excel and freezing panes in Excel.
Frequently asked questions
How do I password protect an Excel file?
Open the workbook, select File, Info, Protect Workbook and Encrypt with Password. Enter a password, confirm it and save the file.
Can I password protect an Excel file in Excel for the web?
You cannot encrypt a workbook with a password in the web version. Open the file in the Excel desktop app and encrypt it there.
What is the difference between protecting a workbook and a worksheet?
Workbook structure protection stops people adding, moving, deleting, hiding or renaming sheets. Worksheet protection locks cells so they cannot be edited. Neither one encrypts the file, so neither stops someone opening it.
Can I recover a forgotten Excel password?
Microsoft and university IT guides say encrypted data cannot be recovered without the password. Keep the password safe and keep a backup copy.
Is a password protected Excel file completely secure?
No password is a guarantee. A strong, unique password helps, but Microsoft notes that a password does not necessarily protect a file from malicious intent. Handle the password and the file carefully.
How do I remove the password from an Excel file?
Open the file with the password, go to File, Info, Protect Workbook and Encrypt with Password, clear the password box, select OK and save the file.




