Sign in

Protect an Excel file

To prevent others from accessing data in your Excel files, protect your Excel file with a password. This topic covers the two different ways you can protect an Excel file:

  • using encryption

  • set a password to open or modify an Excel file.

Notes: This topic covers file-level protection only, and not workbook or worksheet protection.


  • Microsoft cannot retrieve forgotten passwords, so be sure that your password is especially memorable.

  • There are no restrictions on the passwords you use with regards to length, characters or numbers, but passwords are case-sensitive.

  • It’s not always secure to distribute password-protected files that contain sensitive information such as credit card numbers.

  • Be cautious when sharing files or passwords with other users. You still run the risk of passwords them falling into the hands of unintended users. Remember that locking a file with a password does not necessarily protect your file from malicious intent.

Encrypt an Excel file

When you encrypt an Excel file, you lock it with a password. Once you encrypt an Excel file, no one else will be able to open it. This is the most common and recommended technique to lock an Excel file.

Follow these steps to encrypt an Excel file:

  1. Click File > Info > Protect Workbook > Encrypt with Password .

  2. Enter a password, and click OK.

    Encrypt Document dialog box
  3. In the Confirm Password dialog box, reenter the password you entered in the previous step.

When a user attempts to open the file, this popup window will appear—prompting the user to enter a Password:

Encrypted file is locked with a password

Set a password to allow reading or modifying

You can set two passwords on the file—one to open the file as read-only, and the other to modify. Then, you can share the appropriate passwords with the users depending on the access level that is appropriate for each user.

Read-only access does not prevent someone from making changes to a file, but it does prevent them from saving those changes unless they rename the file and save it as something other than the original.

For users who need to be able to modify the file, you will need to share both the open and modify passwords.

Follow these steps to set a password to open/modify an Excel file:

Note: In the Mac, go to File > Save As > Options, and then set the password to open or modify the file. Choose Read Only if you want users to open the file as Read-only.

  1. In the Excel file, click File > Save As.

  2. Click a location, such as Computer or your My Site web page.

  3. Click a folder, such as Documents or one of the folders on your OneDrive, or click Browse.

  4. In the Save As popup window, go to the folder you want to use, then click Tools and then click General Options.

    The Tools list in the Save As box
  5. You can specify one or both passwords here—one to open the file and another to modify the file—according to your requirements.

    The General Options dialog box.
  6. Click Save.

On any attempt to open this file, Excel will prompt the user with a password.

Enter a password to open a protected file

If a password has been set to modify the file, a second popup will appear. Users who don’t have the modify password can click Read Only and start viewing the contents of the file.

Modify a protected Excel file with a password

Click File > Info > Protect Workbook to see this protection status.

The Protect Workbook status is enabled when file protection is enabled in Excel

Do the following:

  1. In your Excel file, click File > Info > Protect Workbook, and then click Encrypt with Password.

  2. Delete the password and click OK.

You can change or remove passwords that are set for opening and/or modifying an Excel file, by following the same procedure as setting the passwords.

Simply delete the password you set in the General Options box.

Check for the correct file name

Let's say that you need to share your password-protected workbook with users who use Office Excel 2003 the —default file format is Excel 97-2003 (*.xls). The workbook was saved in the XLS format, but the password you set on the workbook has disappeared.

This happens because your version of Excel uses a new scheme for saving passwords, and the earlier file format doesn't recognize it. As a result, the password is discarded when you save your file to the Excel 97-2003 format.

To resolve this issue, simply set the password again in the *.xls file.

Do you have a specific question?

Post a question in the Excel Community forum

Help us improve Excel

Do you have suggestions about how we can improve the next version of Excel? If so, please check out the topics at Excel User Voice.

See Also

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.