Password protection in Excel works differently depending on whether you want to lock the entire file or just prevent editing

Excel offers two main ways to add a password: you can require a password to open the file at all, or you can let people open it but require a password to make changes. The method you choose depends on how sensitive the data is and whether you want to share read-only access.

On Windows, Mac, and online versions of Excel, the process is straightforward but the menu locations differ slightly. You do not need any special software — the protection is built into Excel itself.

Key Takeaways

  • You can set a password to open the file (encryption) or a password to edit it (workbook protection), or both at once.
  • On Windows Excel, go to File > Info > Protect Workbook > Encrypt with Password for file-level protection.
  • On Mac Excel, use File > Properties > Security to set an opening password.
  • Excel Online does not support password protection directly — you must use the desktop version first, then upload the protected file.
  • If you forget the password, there is no built-in recovery method, so write it down or store it in a password manager before sharing the file.

Password to open the file on Windows Excel

This method encrypts the entire file so that anyone who tries to open it must enter the correct password first. Open the Excel file you want to protect, then click File in the top left corner.

Select Info from the left menu. On the right side, you will see a button labeled Protect Workbook — click the dropdown arrow next to it and choose Encrypt with Password. A dialog box will appear asking you to enter a password. Type your password, then click OK. Excel will ask you to type it again to confirm. Once you click OK a second time, save the file. The next time anyone opens it, they will be prompted to enter the password.

Password to edit the file on Windows Excel

This method lets people open and read the file without a password, but they cannot make changes unless they enter a password. This is useful if you want to share data but prevent accidental or unauthorized edits.

Open the file and go to File > Info. Click Protect Workbook and select Protect Current Sheet or Protect Workbook Structure, depending on what you want to lock. A dialog box will open. Enter a password in the Password to unprotect sheet field (or workbook, depending on which you chose). You can also check the box to require a password to open the file if you want both protections at once. Click OK, confirm the password, and save the file.

Password protection on Mac Excel

The process on Mac is similar but uses a different menu. Open your Excel file and click File at the top of the screen. Select Properties from the dropdown menu. A window will open with several tabs — click the Security tab.

You will see two password fields: one to open the file and one to modify it. Enter a password in whichever field applies to what you want to protect. If you want to require a password just to open the file, fill in the first field. If you want to allow opening but require a password to edit, fill in the second field. You can use both passwords at once. Click OK and save the file.

Password protection in Excel Online

Excel Online (the browser version at Office.com) does not have a built-in password protection feature. If you need to password-protect a file, you must use the desktop version of Excel on Windows or Mac first, then upload the protected file to OneDrive or SharePoint.

Once the file is uploaded, Excel Online will recognize the password protection and prompt anyone who tries to open it. However, you cannot add or change password protection through the online version — you must download the file, edit the protection in desktop Excel, and upload it again.

What happens when someone opens a password-protected file

If you set a password to open the file, a dialog box appears as soon as someone tries to open it. They must type the correct password to proceed. If they enter the wrong password, they cannot access the file at all.

If you set a password to edit only, the file opens normally, but if someone tries to make changes, Excel will prompt them to enter the password. They can read and view the file without entering anything, but editing is blocked until they provide the password.

Removing or changing a password

To remove a password, open the file (you will need to enter the current password if it is file-level protection). Go to File > Info > Protect Workbook > Encrypt with Password (Windows) or File > Properties > Security (Mac). Delete the password from the field and click OK. Save the file.

To change a password, follow the same steps but enter a new password instead of leaving the field blank. You will need to know the old password to make this change.

Important things to know about Excel passwords

Excel passwords are case-sensitive, meaning "Password123" is different from "password123". Write down your password or store it in a password manager, because Excel has no password recovery feature — if you forget it, you cannot open or edit the file.

Password protection in Excel is not military-grade encryption. It is designed to prevent casual access and accidental changes, not to protect against determined hacking attempts. If you are protecting highly sensitive financial or legal data, consider additional security measures like storing the file on an encrypted drive or using a dedicated file encryption tool.

Frequently Asked Questions

Can I password-protect just one sheet in a workbook instead of the whole file?

Yes. Go to File > Info > Protect Workbook > Protect Current Sheet (Windows) or File > Properties > Security (Mac). This locks only the active sheet, allowing other sheets in the same workbook to remain editable. You can protect multiple sheets individually by repeating the process for each one.

What if I forget the password to my Excel file?

Excel does not have a built-in password recovery or reset feature. If you forget the password, you cannot open or edit the file. To avoid this, store passwords in a password manager like Bitwarden, 1Password, or your browser's password storage before sharing the file with others.

Can someone remove the password protection without knowing the password?

Excel's password protection is not designed to resist sophisticated attacks. However, for everyday use and accidental changes, it is effective. If you need stronger security, use file-level encryption through your operating system or a dedicated encryption tool instead.

Does password protection work if I share the file through OneDrive or Google Drive?

Yes. The password protection is embedded in the file itself, not in the sharing service. Whether you send the file via email, OneDrive, SharePoint, or Google Drive, anyone who opens it will be prompted for the password. However, they can still download the file and attempt to crack the password offline.

Can I set different passwords for different people?

No. Excel password protection uses a single password for the entire file. Everyone who needs to edit the file must use the same password. If you need different access levels for different people, consider using OneDrive or SharePoint permissions instead, which allow you to control who can view, edit, or comment on the file.