The fastest way to lock an Excel file

To password protect an Excel file so that others cannot open it without entering a password, use the Save As dialog and select the encryption option before saving. In Excel on Windows or Mac, this takes about 30 seconds and requires no additional software.

The process is the same whether you use Excel 2016, 2019, 2021, or Microsoft 365. The file stays locked every time someone tries to open it — they will see a password prompt before the spreadsheet appears.

Key Takeaways

  • Open your file, go to File > Save As, choose your location, then click Tools or Options to find the encryption setting.
  • The password you set is the only way to open the file — if you forget it, Microsoft cannot recover it for you.
  • Password-protecting a file is different from protecting individual sheets or cells; it locks the entire file from being opened at all.
  • The file remains locked on any device where it is opened — the password does not expire and does not need to be reset.

Password protect on Windows

Open the Excel file you want to lock. Click File in the top left corner, then select Save As. Choose where you want to save the file — your computer, OneDrive, or another location — and give it a name.

Before you click Save, look for a button labeled Tools (on older versions) or the three dots menu. Click it and select General Options. A small dialog box will appear with two password fields: one says "Password to open" and one says "Password to modify."

Type your password in the Password to open field. This is the password that will lock the file. You do not need to use the "Password to modify" field — that is for a different purpose and is optional. Click OK, then type your password again to confirm it. Click Save.

The file is now locked. The next time anyone opens it, they will see a password prompt before the spreadsheet loads.

Password protect on Mac

Open the file and click File, then Save As. Enter a filename and choose where to save it. Before clicking Save, check the box that says Encrypt with password — it appears near the bottom of the dialog.

A password entry window will pop up. Type your password and click OK. Type it again to confirm. Then click Save. The file is now password protected.

What happens when someone tries to open a locked file

When another person (or you, on another device) tries to open the password-protected file, Excel will display a dialog box asking for the password before the spreadsheet appears. They cannot see any of the data, formulas, or sheets until they enter the correct password.

If they enter the wrong password, they can try again. There is no limit to the number of attempts, but each wrong entry requires them to click back and try once more. This is different from locking individual cells or sheets, where someone with the right knowledge can sometimes work around the protection — a password-protected file cannot be opened without the password.

Important: You cannot recover a forgotten password

Write down your password and store it somewhere safe. Microsoft does not have a way to recover or reset a password you have set on an Excel file. If you forget it, you cannot open the file. There is no "forgot password" option, no recovery email, and no way for Microsoft support to unlock it.

If you lose the password and need the file, your only option is to use a third-party password recovery tool, which may or may not work depending on the Excel version and the complexity of your password. It is far easier to remember the password from the start.

The difference between "password to open" and "password to modify"

When you set a password in the General Options dialog, you see two fields. Password to open locks the entire file — no one can see it without entering the password. Password to modify is different: it allows someone to open the file without a password, but they cannot make changes or save it unless they enter a second password.

For most situations, you only need "Password to open." Use "Password to modify" only if you want to share a file with people who can view it but not edit it. If you set both passwords, the file will ask for the open password first, then the modify password if someone tries to make changes.

Removing a password from a locked file

To remove the password protection, open the file (you will need to enter the password), then go to File > Save As. On Windows, click Tools > General Options. On Mac, check the Encrypt with password box. Delete the password from the field so it is blank, then click OK and Save.

The file is now unlocked and no longer requires a password to open. Anyone can open it without entering anything.

Frequently Asked Questions

Can I password protect a file stored on OneDrive or SharePoint?

Yes. Use Save As and follow the same steps, but choose OneDrive or SharePoint as your save location instead of your computer. The password protection works the same way — the file is locked whether it is stored locally or in the cloud.

Does password protecting a file also protect individual sheets inside it?

No. Password protecting the file locks the entire file from being opened. Protecting individual sheets (which prevents editing of specific cells) is a separate feature. You can do both if you want — lock the file with a password and also protect certain sheets inside it.

What if I set a password but then save the file again without using Save As?

If you use regular Save (Ctrl+S or Command+S), the password stays in place. The file remains locked. You only lose the password if you deliberately remove it through Save As and delete it from the password field.

Can someone copy my password-protected file and open it without the password?

No. The password is attached to the file itself. If someone copies the file, the copy is still locked with the same password. They cannot bypass it by moving or copying the file to another location or device.

Is password protection the same as file encryption?

Excel's password protection uses encryption, but the terms are not exactly the same. Password protection is the feature you set; encryption is the technology that makes it work. When you password protect a file, Excel encrypts it so that the contents cannot be read without the correct password.