The quickest way to password-protect an Excel file

On Windows, open your Excel file, go to File > Info > Protect Workbook > Encrypt with Password. Type your password twice and save the file. On Mac, the path is File > Properties > Security > check the box next to "Encrypt file contents to find data" and enter your password. Both methods encrypt the entire file so it cannot open without the correct password.

The password you set becomes the only way to open that file. Anyone without it will see a password prompt the moment they try to open it. This is different from protecting specific cells or sheets — a file password locks the whole document.

Key Takeaways

  • Windows users set a file password through File > Info > Protect Workbook > Encrypt with Password, then type the password twice.
  • Mac users check the "Encrypt file contents to find data" box in File > Properties > Security and enter their password.
  • A file password prevents anyone from opening the document at all without entering the correct password.
  • If you forget the password, there is no built-in recovery method — write it down or store it in a password manager before you close the file.
  • File passwords work on .xlsx, .xlsm, and other modern Excel formats, but not on older .xls files.

Step-by-step for Windows users

Start with the file open in Excel. Click the File tab in the top left corner. From the menu on the left, select Info. On the right side of the screen, you will see a button labeled Protect Workbook with a dropdown arrow. Click that arrow and select Encrypt with Password.

A dialog box will appear asking you to enter a password. Type your password in the first field. Type it again in the second field to confirm you entered it correctly. Click OK. Excel will ask you to save the file — click Save or press Ctrl+S. The password is now active. The next time anyone opens this file, they will see a password prompt before the spreadsheet appears.

Step-by-step for Mac users

Open your Excel file in Excel for Mac. Click File in the menu bar at the top. Select Properties from the dropdown. A new window will open. Look for the Security section. You will see a checkbox next to "Encrypt file contents to find data" — click it to turn it on.

A password entry box will appear. Type your password and click OK. Excel will prompt you to save the file. Click Save to explore the password. From now on, the file will require the password to open.

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

When a user opens a password-protected Excel file, they see a dialog box before the spreadsheet loads. The box says "This file is password protected" or similar language depending on your Excel version. There is a text field where they must type the password. If they enter the wrong password and click OK, Excel rejects it and shows the prompt again. They can try as many times as they want, but the file will not open without the correct password.

This protection applies whether the file is opened in Excel on a computer, in Excel Online through a web browser, or in Excel on a mobile device. The password requirement is built into the file itself, not dependent on where it is opened.

Password strength and what to avoid

A strong password for an Excel file is at least 8 characters long and includes uppercase letters, lowercase letters, numbers, and symbols like ! or @. Avoid passwords that are dictionary words, birthdays, or names — these are straightforward to guess. Do not use the same password you use for email, banking, or other sensitive accounts.

Excel passwords are case-sensitive, meaning "MyPassword" is different from "mypassword". Write down your password or store it in a password manager like Bitwarden, 1Password, or KeePass before you close the file. If you forget the password, Excel has no built-in recovery method. You cannot open the file without it.

File format matters: which Excel files support passwords

Password protection works on modern Excel formats: .xlsx (the standard format), .xlsm (Excel with macros), and .xltx (Excel templates). It does not work on older .xls files, which use an outdated format. If you have an older file and need to password-protect it, save it as .xlsx first by going to File > Save As, choosing the location, and selecting "Excel Workbook (.xlsx)" from the file type dropdown.

If you share a password-protected file with someone using an older version of Excel or a non-Microsoft spreadsheet program like Google Sheets or LibreOffice, they may not be able to open it at all, or the password protection may not work as expected. Test with the person before you send the file if you are unsure about their software version.

The difference between file passwords and sheet protection

A file password locks the entire document — no one can open it without the password. Sheet protection, by contrast, allows someone to open the file but prevents them from editing specific cells, deleting sheets, or changing formulas. These are two separate features and serve different purposes.

If you want to let someone view your spreadsheet but not change it, sheet protection is the right choice. If you want to keep the file completely private until someone enters a password, use file encryption. You can use both at the same time: encrypt the file with a password to control who opens it, and protect specific sheets to control what they can edit once inside.

Frequently Asked Questions

Can I change or remove a password after I set it?

Yes. Open the file and enter the current password. Go to File > Info > Protect Workbook > Encrypt with Password (Windows) or File > Properties > Security (Mac). Clear the password field and leave it blank, then click OK and save. This removes the password entirely. To change it, enter a new password instead of leaving it blank.

What if I forgot my Excel file password?

Excel does not have a password recovery tool. If you forget the password, you cannot open the file through normal means. Some third-party password recovery tools claim to crack Excel passwords, but they are unreliable and may contain malware. Your best option is to keep a backup copy of important files without a password, or store passwords in a dedicated password manager.

Does password-protecting an Excel file encrypt the data inside?

Yes. When you set a file password in Excel, the entire file is encrypted using AES-256 encryption on modern versions. This means the data inside is scrambled and unreadable without the password. Older Excel versions used weaker encryption, so if security is critical, make sure you are using a recent version of Excel.

Can I password-protect an Excel file in Google Sheets or LibreOffice?

Google Sheets does not have a built-in file password feature. You can share the file with specific people and control their permissions, but there is no password prompt. LibreOffice Calc does support file passwords through Tools > Options > Security > Password. The process is similar to Excel, but the file must be saved in LibreOffice's native format (.ods) for the password to work reliably.

Will the password protect my file if I upload it to OneDrive or Google Drive?

Yes. The password is part of the file itself, not dependent on where it is stored. If you upload a password-protected Excel file to OneDrive, Google Drive, or any other cloud service, the password protection remains active. Anyone who downloads the file will need the password to open it.