Password protection locks your Excel file so only people with the password can open it

When you add a password to an Excel file, Windows or Mac encrypts the file and requires anyone opening it to type the correct password first. This works on both .xlsx files (the standard format) and older .xls files. The password you set is the only way in — if you forget it, Microsoft cannot recover it for you, so write it down somewhere safe before you close the file for the first time.

The steps differ slightly between Windows and Mac, and between Excel desktop and Excel online. Desktop Excel gives you the most control. Online Excel (the version you access through a web browser) does not have a native password feature, so you would need to download the file, password-protect it on desktop, then upload it back.

Key Takeaways

  • On Windows or Mac desktop Excel, go to File > Info > Protect Workbook > Encrypt with Password to set a password.
  • You must type the password twice to confirm it, and Excel will not show you what you typed, so type slowly and carefully.
  • If you forget the password, there is no recovery option — Microsoft cannot unlock the file for you.
  • Password protection encrypts the entire file, so no one can open it or see any sheets without the correct password.
  • Excel online does not support password protection directly, so you must use the desktop version or a third-party tool.

How to password-protect an Excel file on Windows

Open the file you want to protect in Excel on your Windows computer. Click the File tab in the top left corner. From the menu that opens, click Info on the left side.

Look for a button labeled Protect Workbook in the center of the screen. Click the dropdown arrow next to it and select Encrypt with Password. A small dialog box will appear with a single text field labeled "Password".

Type your password into the field. Excel does not show you the characters as you type — you will see only dots or asterisks. Type slowly and carefully, because you cannot see what you entered. Click OK.

Excel will ask you to type the password again to confirm it. Type the exact same password in the second dialog box and click OK. If the two passwords match, the file is now encrypted. Save the file by pressing Ctrl+S or clicking File > Save. The password is now active.

How to password-protect an Excel file on Mac

Open the file in Excel on your Mac. Click the File menu at the top of the screen and select Info. You will see a section labeled Protect Workbook with a dropdown menu.

Click the dropdown next to Protect Workbook and choose Encrypt with Password. A dialog box will appear asking you to enter a password. Type your password — again, you will see only dots, not the actual characters.

Click OK. Mac will prompt you to type the password a second time. Enter it exactly as you typed it the first time and click OK. Save the file by pressing Command+S or using File > Save. The password protection is now in place.

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

When another person (or you, on a different device) tries to open the file, Excel will display a password prompt before the spreadsheet appears. They must type the correct password to proceed. If they type an incorrect password, Excel will show an error message and let them try again, but there is no limit to how many times they can attempt it.

Once the correct password is entered, the file opens normally and the person can view, edit, and save changes just like any other Excel file. The password does not restrict what they can do inside the file — it only controls whether they can open it at all.

Important things to know before you set a password

Write down your password and store it somewhere secure before you close the file. If you forget the password, there is no "forgot password" option and no way to recover it. Microsoft does not keep a record of your password, and no tool can unlock an encrypted Excel file without it. You will have to recreate the spreadsheet from scratch.

Password protection encrypts the entire file, so it applies to all sheets in the workbook at once. You cannot password-protect individual sheets while leaving others open. If you need that level of control, you would need to split the data into separate files.

The password you set is case-sensitive, meaning "Password123" is different from "password123". Excel will reject either one if you typed the other. This makes your password stronger, but it also means you must remember the exact capitalization.

How to remove a password from an Excel file

Open the password-protected file in Excel and type in the password when prompted. Once the file is open, go to File > Info > Protect Workbook > Encrypt with Password again. This time, the password field will be empty (or show a placeholder). Leave it blank and click OK. Excel will ask you to confirm by clicking OK again.

Save the file. The password protection is now removed, and anyone can open the file without entering a password. If you ever want to add a password back, you can follow the same steps and enter a new password in the field.

Password protection versus other security options in Excel

Excel offers other security features beyond password protection. You can restrict editing (so people can view the file but not change it), protect individual sheets with different passwords, or mark a file as final. These options are also found under File > Info > Protect Workbook, but they work differently than full file encryption.

Restricting editing is weaker than password protection — someone with technical knowledge can sometimes bypass it. Full password encryption (the method described above) is the strongest option and is what you should use if you want to keep the file completely private. The other options are useful if you want to share the file but prevent accidental changes.

Frequently Asked Questions

Can I password-protect an Excel file in the online version?

Excel online does not have a built-in password feature. You must download the file to your computer, password-protect it using desktop Excel, then upload it back to OneDrive or SharePoint. Alternatively, you can password-protect the file at the folder level using your cloud storage provider's security settings.

What if I type the password wrong when setting it up?

Excel will reject the password if the confirmation does not match the first entry. You will see a message saying the passwords do not match, and you can try again. Start over and type both passwords carefully, paying attention to capitalization and spacing.

Can someone crack or bypass the password?

Excel uses encryption to protect the file, which is very difficult to break with modern computers. For practical purposes, a strong password (at least 8 characters, mixing letters, numbers, and symbols) makes the file secure. However, if someone has advanced technical tools and unlimited time, they might be able to crack a weak password.

Does password protection slow down the file or cause problems?

No. Password protection does not affect how the file performs or how large it is. The only difference you will notice is the password prompt when opening it. The file works exactly the same once it is open.

Can I share a password-protected file with others?

Yes. You can email the file or share it through cloud storage just like any other file. You will need to tell the recipient the password separately — do not include it in the same email or message as the file. You can share the password through a phone call, text message, or a different email thread.