Password protection locks your Excel file so no one can open it without the password you set

You can add a password to an Excel file in a few clicks using the built-in protection feature. When you save the file with a password, Excel encrypts it — meaning the file becomes unreadable without the correct password. This works on both Windows and Mac, and the password stays with the file no matter who has it or where it goes.

The process is different from protecting just the cells or sheets inside a file. Password-protecting the entire file means someone cannot even open it to see what is in it. If you only want to prevent editing of certain cells while keeping the file viewable, that is a separate feature covered later in this guide.

Key Takeaways

  • You set a file password when you save the file, not after — use File > Save As and choose the encryption option before clicking Save.
  • Excel passwords are case-sensitive, so "MyPassword" is different from "mypassword" — write it down somewhere safe if you might forget it.
  • If you lose the password, there is no built-in way to recover it, so Excel cannot unlock the file for you.
  • Protecting the file itself is different from protecting individual sheets or cells — file protection prevents anyone from opening it, while sheet protection only prevents editing.

How to password-protect an Excel file on Windows

Open the file you want to protect in Excel. Go to File in the top left, then click Save As. Choose where you want to save the file — you can save it in the same location with the same name, or give it a new name. The location does not matter for password protection.

At the bottom of the Save As window, you will see a button that says Tools (it may be small and easy to miss). Click the dropdown arrow next to it and select General Options. A dialog box will open with two password fields: one for opening the file and one for modifying it. You only need to fill in the first field — "Password to open" — to prevent anyone from opening the file without the password.

Type your password in the "Password to open" field. Excel will not show you what you are typing for security reasons. Click OK. Excel will ask you to type the password again to confirm it — this catches typos. Type it exactly the same way, then click OK again. Now click Save to finish. The file is now password-protected.

How to password-protect an Excel file on Mac

Open the file you want to protect. Go to File at the top of the screen and click Save As. Choose a location and name for the file. Below the filename field, you will see a checkbox that says Encrypt with password — check this box.

A password dialog will appear. Type your password in the field. Excel will not display what you type. Click OK, then type the password again to confirm it. Click OK once more, then click Save. Your file is now password-protected.

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

When anyone — including you — tries to open a password-protected Excel file, a dialog box appears asking for the password before the file will open. They cannot see any part of the spreadsheet, the sheet names, or even how many sheets are in the file without entering the correct password first. If they type the wrong password, Excel will reject it and ask them to try again.

This is different from sheet protection, where someone can open the file and see the data but cannot edit certain cells. File-level password protection is the strongest option if you want to keep the contents completely hidden.

The difference between file passwords and sheet protection

A file password prevents anyone from opening the file at all. Sheet protection prevents editing within an open file. You might use sheet protection if you want coworkers to see a spreadsheet but not change certain cells, while you use file passwords when you want to keep the entire file private.

You can use both at the same time — password-protect the file so it cannot be opened without a password, and also protect individual sheets so that even after someone opens it with the password, they cannot edit the cells you have locked. These are separate settings and work independently.

What to do if you forget the password

Excel does not have a built-in password recovery tool. If you forget the password to a file you created, there is no official way to unlock it through Excel or Microsoft. The file will remain locked unless you remember the password.

This is why it is important to store your password somewhere safe — a password manager, a secure note, or written down in a place only you can access. If you are setting a password on a file you plan to share with others, make sure you have a way to communicate the password to them separately from the file itself.

Removing or changing a file password

To change or remove a password, open the file with the current password. Go to File and click Save As. On Windows, click Tools and select General Options. On Mac, check the Encrypt with password box. To remove the password entirely, leave the password field blank and click OK. To change it, type the new password instead. Click Save to apply the change.

You must be able to open the file first — if you have forgotten the password, you cannot change it without unlocking the file. This is another reason to keep your password recorded somewhere you can find it.

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 the screen and select Protect Sheet. This prevents editing of that sheet but does not prevent opening the file. If you want to hide the sheet entirely, use the Hide option instead, though hidden sheets can be unhidden by anyone with access to the file.

What if I want people to open the file but not edit it?

You have two options. You can password-protect the file with a "Password to modify" (the second field in General Options on Windows, or a separate setting on Mac) — this lets people open it without a password but requires a password to make changes. Or you can protect individual sheets to lock specific cells while leaving others editable.

Does the password work if someone copies the file to a different computer?

Yes. The password is built into the file itself, not tied to your computer or account. The file will be password-protected no matter where it is moved or who has it.

Is Excel password protection secure enough for sensitive data?

Excel passwords protect against casual access, but they are not military-grade encryption. If you are protecting highly sensitive financial or medical data, consider additional security measures like storing the file on an encrypted drive or using a dedicated secure file storage service.

Can I use special characters or spaces in my Excel password?

Yes. Excel passwords can include uppercase and lowercase letters, numbers, spaces, and special characters like !@#$%^&*(). Longer passwords with a mix of character types are harder to guess, but remember that Excel passwords are case-sensitive.