Excel has a built-in password feature that locks your file so only someone with the password can open it
You can password-protect an Excel file in about 30 seconds using the Save As dialog. The file itself becomes encrypted — Windows and Mac both handle the encryption automatically once you set the password. This works for .xlsx files (Excel 2007 and newer) and older .xls formats. The person who opens your file must type the correct password or they cannot see any of the data inside.
The steps are slightly different depending on whether you use Windows or Mac, and whether you use Excel desktop or Excel online. Desktop versions give you the most control. Excel online does not have a password feature built in, so you would need to download the file, protect it on your computer, and upload it again.
Key Takeaways
- Password-protecting an Excel file prevents anyone without the password from opening it, and the encryption happens automatically when you save.
- You set the password through File > Save As > Tools > General Options (Windows) or File > Save As > Options (Mac), not through a separate security menu.
- Write your password down somewhere safe outside your computer, because Excel cannot recover a forgotten password.
- Password protection works on both .xlsx and .xls files, but Excel online does not support this feature — you must use the desktop version.
- If you share the file with others, they will need the password every time they open it, so only use this when the file contains sensitive information.
How to password-protect an Excel file on Windows
Step 1: Open your file in Excel and make sure all your changes are saved. You cannot set a password on a file that is not yet saved, so if this is a new file, save it first with any name you want.
Step 2: Click File in the top left corner, then click Save As. A dialog box will open showing your current file name and location.
Step 3: Look for a button labeled Tools near the bottom right of the Save As dialog. Click the small dropdown arrow next to it and select General Options. A new window titled "General Options" will appear.
Step 4: Type your password in the field labeled "Password to open". This is the password someone will need to type to open the file at all. Leave the "Password to modify" field empty unless you want a second password that allows people to view the file without a password but requires a password to make changes — most people do not use this option.
Step 5: Click OK. Excel will ask you to type the password again to confirm it. Type it exactly the same way, then click OK again.
Step 6: Click Save in the main Save As dialog. Your file is now password-protected. The next time anyone opens it, they will see a password prompt before the file loads.
How to password-protect an Excel file on Mac
Step 1: Open your file and save it if it is new. Click File in the menu bar at the top, then click Save As.
Step 2: Look for a checkbox labeled "Encrypt with password" near the bottom of the Save As dialog. Check this box. A password field will appear below it.
Step 3: Type your password in the field that appears. You will not see the characters you type — they will show as dots for security.
Step 4: Click Save. Mac will ask you to type the password one more time to confirm. Type it exactly the same way and click Save again. Your file is now protected.
What happens when someone tries to open a password-protected file
When another person opens your protected file, Excel shows a password dialog before the spreadsheet appears. They must type the correct password to proceed. If they type it wrong, they can try again, but they cannot see any of the file contents until they enter the right password.
The password is case-sensitive, which means "MyPassword" is different from "mypassword". Make sure anyone you share the file with knows this, because a single wrong capital letter will lock them out.
How to remove a password from an Excel file
If you want to unprotect a file later, open it with the password, then go to File > Save As again. On Windows, click Tools > General Options and delete the text in the "Password to open" field, leaving it blank. On Mac, uncheck the "Encrypt with password" box. Click Save and choose to overwrite the original file. The file is now unprotected.
You will need to know the original password to remove it. If you forget the password, there is no recovery method — Excel does not store passwords anywhere you can retrieve them, and the company cannot unlock the file for you.
Important things to know before you password-protect
Password protection encrypts the entire file, so the file size does not change and it works with all Excel features. However, once you set a password, anyone who wants to open the file needs it every single time — there is no way to open it "just this once" without the password.
If you work with others on the file, they will all need the same password. You cannot give different passwords to different people. If someone leaves your team and you want to prevent them from opening the file, you must change the password and send the new one to everyone else.
Write your password down in a secure location outside your computer — a physical notebook, a password manager, or another safe place. If you forget it, the file is locked permanently and unrecoverable. Excel has no "forgot password" option and no way to reset it.
Alternatives if password protection is not enough
Password protection prevents someone from opening the file at all, but it does not prevent them from copying the data if they have the password. If you need to control what people can do inside the file — like preventing them from editing certain cells or deleting rows — you need sheet protection instead, which is a different feature found under the Review tab.
If you need to share sensitive files with people outside your organization, consider storing them in a cloud service like OneDrive or SharePoint instead, where you can control who has access and revoke it later without changing a password. You can still password-protect the file as an extra layer, but cloud storage gives you more control overall.
Frequently Asked Questions
Can I password-protect just one sheet in my workbook instead of the whole file?
No, password protection locks the entire file. If you want to protect only certain sheets, use sheet protection instead, which you will find under the Review tab. Sheet protection prevents people from editing specific cells or deleting rows, but they can still open the file without a password.
What if I forget my password?
There is no recovery method. Excel does not store passwords anywhere, and the company cannot unlock the file. Write your password down in a secure place before you close the file for the first time. If you forget it, the file is locked permanently.
Does password protection work if I save the file as a PDF instead?
No, you must save it as an Excel file (.xlsx or .xls) for password protection to work. If you convert it to PDF, you lose the Excel password feature. PDFs have their own separate password protection, which you would set through your PDF reader or converter.
Can someone crack or bypass the password?
Excel uses strong encryption, so a password cannot be easily guessed or bypassed by standard methods. However, if someone has physical access to your computer or your cloud storage, they may be able to access the file through other means. Password protection is best used alongside other security practices like keeping your computer locked and using strong account passwords.
If I password-protect a file, can I still use it in Excel online?
Yes, but you must open it with the password first on your desktop, then upload it to OneDrive or SharePoint. Once it is in the cloud, Excel online will ask for the password when you try to open it. However, you cannot set or change the password through Excel online — you must use the desktop version for that.