The Two Ways to Password Protect an Excel File

Excel gives you two separate password options, and they do different things. A password to open prevents anyone from viewing the file at all without typing the correct password first. A password to modify lets people open and read the file, but they cannot make changes unless they enter a password. Most people want the first one — a password to open — because it locks the entire file.

Both passwords are set in the same place: the Save As dialog. You do not need to install anything or use a separate tool. The steps are nearly identical whether you use Excel on Windows, Mac, or the web version, though the web version has fewer options.

Key Takeaways

  • A password to open locks the entire file; a password to modify only prevents editing, and the file remains readable without a password.
  • Both passwords are set through File > Save As, then the Tools or Options button in the save dialog.
  • Excel passwords are case-sensitive, so "MyPassword" is different from "mypassword".
  • If you forget the password, there is no built-in recovery method — Excel cannot retrieve it for you.
  • Passwords protect the file from casual access but are not military-grade encryption; for highly sensitive data, consider additional security measures.

How to Add a Password to Open (Windows)

Open the file you want to protect. Click File in the top left, then click Save As. Choose the folder where you want to save the file (usually the same folder it is already in). At the bottom of the Save As dialog, you will see a button labeled Tools — click the small dropdown arrow next to it and select General Options.

A dialog box titled "General Options" will appear. You will see two password fields: "Password to open" and "Password to modify". Type your password in the "Password to open" field. Use a password you will remember but that others cannot guess — a mix of letters, numbers, and symbols is stronger than a single word. Click OK.

Excel will ask you to type the password again to confirm it. Type the exact same password and click OK. Then click Save in the main Save As dialog. The file is now password-protected. The next time anyone opens it, they will see a password prompt before the file loads.

How to Add a Password to Open (Mac)

Open the file you want to protect. Click File at the top, then Save As. Choose your save location and give the file a name. Before you click Save, look for a button or checkbox labeled Options — on some Mac versions it appears as a small arrow or disclosure triangle. Click it to expand the options.

You will see a checkbox that says "Encrypt file contents". Check this box. A password field will appear below it. Type your password, then click Save. Mac will ask you to confirm the password. Type it again and click Save. The file is now encrypted and will require a password to open.

How to Add a Password to Modify Only (Windows and Mac)

If you want people to be able to open and read the file without a password, but prevent them from making changes, use the "Password to modify" field instead. Follow the same steps as above (File > Save As > Tools/Options > General Options on Windows, or File > Save As > Options on Mac), but this time type your password in the Password to modify field, not the "Password to open" field.

When someone opens the file without entering the password, they will see a prompt asking whether they want to open it as read-only. If they click "Read-Only", they can view everything but cannot save changes. If they enter the password, they get full editing access. This option is useful when you want to share a file for review but prevent accidental edits.

How to Add a Password in Excel Online

Excel Online (the web version you access through Office.com or Microsoft 365) does not have a built-in password feature. If you need to password-protect a file stored in OneDrive or SharePoint, you have two options: read the file to your computer, add the password using the desktop version of Excel (following the steps above), then upload it back; or use your cloud storage's sharing settings to restrict who can access the file.

If you are working in Excel Online and want password protection, the simplest approach is to read the file, open it in the desktop version of Excel, add the password, and save it back to your cloud storage. This takes about two minutes and gives you the full password protection that the web version cannot provide.

What Happens When Someone Tries to Open a Password-Protected File

When a password-protected file is opened, the person sees a dialog box asking for the password before anything else loads. They cannot see the spreadsheet, the sheet names, or any data until they enter the correct password. If they type the wrong password, they can try again, but there is no limit on attempts — someone could theoretically try many passwords in a row.

If you set only a "Password to modify", the dialog offers two buttons: "Read-Only" and "OK". Clicking "Read-Only" opens the file without a password but locks it from editing. Clicking "OK" requires the password to proceed.

Important Things to Know About Excel Passwords

Passwords are case-sensitive, meaning "MyPassword" is completely different from "mypassword". Write down your password somewhere safe if you think you might forget it, because Excel has no password recovery feature. If you lose the password, the file cannot be opened without it, and there is no customer service that can retrieve it for you.

Excel passwords protect your file from casual access — someone cannot open it by accident or without permission. However, they are not the same as military-grade encryption. If you work with highly sensitive data (financial records, medical information, legal documents), consider storing the file in a location with additional security, such as an encrypted hard drive or a find cloud service with two-factor authentication.

If you share a password-protected file with someone, you will need to give them the password through a separate channel — never include the password in an email with the file itself. Text it separately, call them, or use a password manager that both of you have access to.

Frequently Asked Questions

Can I change the password later without losing my data?

Yes. Open the file with the current password, then go to File > Save As and follow the same steps to set a new password. You can change it as many times as you want. The data inside stays exactly the same.

What if I forgot my password?

Excel does not have a password recovery tool. If you forget the password, the file cannot be opened. This is by design — it prevents anyone (including Microsoft) from bypassing the protection. If the file is critical, your only option is to contact whoever gave you the file and ask for a version without a password.

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

Yes, but that is a different feature called "sheet protection", not file password protection. Sheet protection prevents editing of a specific sheet but does not lock the file itself. If you want to lock the entire file so no one can even open it, use the file password method described in this guide.

Does password protection slow down Excel?

No. The file opens and works normally once the password is entered. The password check happens only at the moment you open the file, not while you are working in it.

Can someone remove the password without knowing it?

Not with standard Excel tools. Specialized software exists that claims to crack Excel passwords, but it is slow and unreliable, especially for longer passwords. A strong password (12 characters or more, mixing letters, numbers, and symbols) makes this impractical for most people.