Excel lets you lock a file so only someone with the password can open it or edit it
You can add a password to an Excel file in two ways: require a password to open the file at all, or require a password to make changes while allowing others to view it read-only. Both options are built into Excel itself — you do not need extra software. The steps differ slightly depending on whether you use Excel on Windows, Mac, or the web version.
Password protection happens when you save the file, not after. This means you choose your protection method before you save, and the password takes effect immediately. If you have already saved an unprotected file, you can add protection by opening it and saving it again with a password.
Key Takeaways
- You set a password when you save the file using "Save As" and the encryption options in the Save dialog.
- A password to open the file prevents anyone without it from viewing or editing the spreadsheet at all.
- A password to modify the file lets people view it without a password but requires a password to make changes.
- Excel passwords are case-sensitive, so "MyPassword" is different from "mypassword".
- If you forget the password, there is no built-in recovery method — write it down or store it somewhere you can retrieve it.
How to password-protect an Excel file on Windows
Open the file you want to protect. Go to File in the top left, then click Save As. Choose where you want to save the file — you can save it to the same location with the same name, which will overwrite the old version.
Before you click Save, look for a button labeled Tools near the bottom right of the Save dialog. Click the dropdown arrow next to it 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."
If you want to require a password just to open the file, type your password in the "Password to open" field only. If you want to let people view the file without a password but require one to edit it, use only the "Password to modify" field. You can use both passwords if you want different levels of protection, but most people use one or the other.
Type your password carefully — the field will show dots instead of letters. Click OK, and Excel will ask you to type the password again to confirm it. Then click Save. The file is now protected.
How to password-protect an Excel file on Mac
Open the file and go to File at the top of the screen, then select Save As. Choose your save location and file name.
Look for a checkbox labeled Encrypt with password near the bottom of the Save dialog. Check this box if you want to require a password to open the file. A password field will appear — type your password and click Save. Excel will ask you to type it again to confirm.
On Mac, the "encrypt with password" option protects the file from being opened at all. There is no separate "password to modify" option in the Mac version of Excel. If you need that level of control, you can use the Windows version or the web version instead.
How to password-protect an Excel file in Excel Online
Excel Online (the free version you access through a web browser) does not have a built-in password feature. However, if you use Microsoft 365 (the paid subscription), you can protect a file through your OneDrive or SharePoint settings instead of through Excel itself.
To do this, right-click the file in OneDrive or SharePoint and select Share. Set the sharing permissions to "Specific people" and choose who can view or edit. This is not the same as a password — it controls access by user account rather than by a single password — but it serves a similar purpose for files stored in the cloud.
If you need traditional password protection and only have access to Excel Online, download the file to your computer, add the password using the Windows or Mac steps above, and then upload it back to OneDrive.
What happens when someone tries to open a password-protected file
If you set a "password to open," Excel will show a dialog box asking for the password before the file opens at all. The person must type the correct password or they cannot see any part of the spreadsheet.
If you set only a "password to modify," the file opens normally and the person can view all the data. But if they try to edit a cell, make a chart, or change any content, Excel will prompt them for the password. They can still read and copy data without the password — they just cannot save changes.
Changing or removing a password
To change a password, open the file (you will need to enter the current password if it requires one to open). Go to File and select Save As. Before saving, open the Tools menu and select General Options (Windows) or check Encrypt with password (Mac). Clear the old password field and type a new one, then save.
To remove a password entirely, follow the same steps but leave the password fields blank. Save the file, and it will no longer be protected.
Things to know about Excel passwords
Excel passwords are case-sensitive, meaning capital and lowercase letters matter. "MyFile123" is not the same as "myfile123." Write down your password exactly as you typed it, including capitals.
If you forget the password, Excel has no built-in recovery or reset option. You cannot open or edit a file protected with a "password to open" without the correct password. A file protected with only a "password to modify" can still be viewed, but you cannot make changes. Store your password somewhere secure — a password manager, a locked drawer, or another method you trust.
Password protection in Excel is basic encryption. It is suitable for keeping casual viewers out or preventing accidental edits, but it is not military-grade security. If you are protecting highly sensitive data, consider additional measures like storing the file on an encrypted drive or using a dedicated password manager.
Frequently Asked Questions
Can I password-protect just one sheet in a workbook instead of the whole file?
Yes. Right-click the sheet tab at the bottom of Excel and select Protect Sheet. You can set a password that prevents people from editing cells, deleting rows, or changing the sheet structure — but they can still view the data. This is different from file-level protection and does not require a password to open the file itself.
What if I want different people to have different passwords?
Excel does not support multiple passwords for one file. You can set one password to open and one password to modify, but you cannot assign different passwords to different people. If you need that level of control, use OneDrive or SharePoint sharing permissions instead, which let you set access by individual user account.
Does password-protecting an Excel file slow it down?
No. The file will open and run at the same speed. The password is checked when you open or try to edit the file, but it does not affect performance while you are working in it.
Can I password-protect a file that is already shared with others?
Yes, but they will need the password to open it after you add protection. If the file is shared on OneDrive or SharePoint, adding a password does not change the sharing settings — people with access can still see it in their shared files, but they will need the password to open it. Let them know the password through a separate, secure channel.
What file formats support password protection in Excel?
Password protection works with .xlsx files (the standard Excel format) and older .xls files. It also works with .xlsm files (Excel with macros). Some other formats like .csv or .ods may not support the same password features, so stick with .xlsx if password protection is important to you.