How to Lock an Excel File: Complete Guide to Password Protection, Read-Only Mode, and Worksheet Security
How do I lock an Excel file? Step-by-step guide to password protect workbooks, sheets, cells, and ranges in Excel 2019, 2026, and Microsoft 365.

If you have ever asked yourself "how do I lock an Excel file" before sending a budget, payroll register, or client tracker to a colleague, you are not alone. Excel offers at least six distinct ways to lock content, ranging from a simple read-only suggestion to full AES-256 encryption that even Microsoft cannot bypass. Choosing the right method depends on whether you need to block opening, block editing, hide formulas, or simply prevent accidental changes to specific cells while leaving the rest of the workbook editable.
The most common scenario is a workbook that contains sensitive numbers, such as salaries, vendor pricing, or projected revenue, that must be shared with reviewers who should not be able to alter the underlying calculations. In that case, a workbook-level password combined with sheet protection is the gold standard. Microsoft introduced strong AES encryption back in Excel 2007, and every version since, including Microsoft 365 and Excel 2024, uses the same cipher with a 256-bit key length when you save in the modern .xlsx format.
Before you start, it helps to understand the four layers Excel exposes: file-open password, file-modify password, workbook structure protection, and worksheet (sheet) protection. Each layer solves a different problem, and they can be stacked. For example, you might encrypt the file so only authorized users can open it, then protect each sheet so reviewers can read but not edit formulas. If you also use lookups like xlookup excel in your model, locking the formula cells prevents reviewers from accidentally breaking the references.
A second common scenario is the opposite: you want to share the file widely but keep one tab, perhaps a hidden assumptions sheet, locked behind a password. Excel handles that through sheet-level protection, where each worksheet can have its own password independent of the workbook. This is useful for templates distributed across a team where the structure must remain consistent but data entry is encouraged in specific cells.
It is also worth knowing what locking does not do. Locking an Excel file does not prevent someone from taking a screenshot, copying values displayed on screen, or printing the document. It also does not encrypt embedded objects like linked images unless the entire file is encrypted at the workbook level. For true data loss prevention, pair Excel protection with Information Rights Management (IRM) through Microsoft Purview or a sensitivity label.
This guide walks through every locking option in order of strength, from the weakest (Mark as Final) to the strongest (full encryption with a long passphrase). You will see step-by-step instructions, screenshots described in detail, the exact menu paths for Windows, Mac, and Excel for the Web, and recovery strategies if you ever forget the password. By the end you will know exactly which method matches your threat model and how to apply it in under sixty seconds.
Finally, we will cover automation. If you lock files often, learning the two-line VBA macro that applies encryption on save can shave hours off your week, and IT administrators can push the same setting through Group Policy or Microsoft Intune for organization-wide consistency. Whether you are a finance analyst, an HR coordinator, or a small business owner, locking Excel correctly is a five-minute skill that protects years of work.
Excel File Locking by the Numbers

How to Lock an Excel File in Five Steps
Open File and Choose Info
Click Protect Workbook
Choose Encrypt with Password
Confirm and Save
Test the Lock
The strongest way to lock an Excel file is full workbook encryption with a password, and it takes about thirty seconds once you know the menu path. In any version from Excel 2010 forward, click File, then Info, then Protect Workbook, then Encrypt with Password. Type a passphrase, confirm it, and save. The file is now encrypted with AES-256, and anyone who tries to open it without the password will see a generic error message rather than partial content.
Password choice matters more than people realize. Excel hashes the password using SHA-512 with 100,000 iterations of salt before deriving the encryption key, which means short passwords like "1234" can be cracked in seconds by commercial recovery tools, while a 16-character random passphrase would take longer than the age of the universe to brute force. Use a password manager such as Bitwarden, 1Password, or the built-in Microsoft Authenticator to generate and store something like "Coral-Reef-Mango-7392!" rather than your dog's name.
Workbook structure protection is a separate option found under the same Protect Workbook menu. It prevents users from adding, deleting, hiding, unhiding, or renaming worksheets, but it does not encrypt the file or prevent opening. This is useful for templates where you want the layout preserved. Combine it with sheet protection for layered defense. Remember that structure protection uses a much weaker cipher than file encryption and can be bypassed by anyone willing to unzip the .xlsx and edit the XML.
A frequently overlooked third option is the modify password, accessible through File, Save As, Tools (next to the Save button), General Options. Here you can set two separate passwords: one to open and a different one to modify. Users who only know the modify password get read-only access. This pattern is perfect for distributing reports where viewers should not change numbers but should be able to copy values for their own analysis.
If you work in a regulated industry like healthcare, finance, or government, consider pairing workbook encryption with a Microsoft Purview sensitivity label. Labels like "Confidential - All Employees" automatically apply encryption, restrict forwarding, and add a visible watermark, all enforced by Azure Rights Management rather than a local password. The advantage is centralized revocation: if an employee leaves, IT can revoke access to every labeled file they ever created, even copies stored on personal devices.
For one-off sharing, the Mark as Final feature offers a non-cryptographic alternative. It sets the file to read-only and displays a yellow banner, but any user can click Edit Anyway to remove the restriction. Use it only as a soft hint to reviewers, not as a security control. Similarly, hiding a worksheet by right-clicking the tab and choosing Hide is not protection at all; the hidden sheet remains in the file and can be unhidden with two clicks unless the workbook structure is also locked.
One pro tip for power users: if your workbook contains complex lookup formulas and you want to learn how to find duplicates in excel before locking the file, run that audit first. Locking a sheet freezes all formulas in their current state, and any errors hidden behind protection become much harder to diagnose later. Always validate, then lock, never the reverse.
Locking Sheets, Cells, and Ranges with VLOOKUP Excel Models
To lock a single worksheet, right-click the sheet tab at the bottom of the workbook and choose Protect Sheet. A dialog appears with a password field and a long list of checkboxes for actions you want to allow, such as selecting locked cells, formatting columns, or inserting rows. Leave only the actions you want users to perform, enter a password, and click OK.
By default, every cell in Excel has the Locked attribute turned on, but that attribute only takes effect when the sheet is protected. This counterintuitive design means you must protect the sheet for any locking to actually happen. Sheet passwords use a weak 16-bit hash, so they stop casual users but not determined attackers. For real security, combine sheet protection with full workbook encryption.

Should You Lock Every Excel File You Share?
- +Prevents accidental edits to formulas and reference data
- +AES-256 encryption meets HIPAA, GDPR, and SOX compliance requirements
- +Workbook structure protection preserves template layouts across teams
- +Hidden formula attribute protects proprietary calculation logic
- +Granular range protection enables multi-user collaboration safely
- +Mark as Final provides a low-friction visual warning to reviewers
- +Compatible with Microsoft Purview sensitivity labels for enterprise control
- −Lost passwords cannot be recovered by Microsoft under any circumstance
- −Sheet-level passwords use weak 16-bit hashing easily bypassed by free tools
- −Locking does not prevent screenshots, printing, or copy-paste of values
- −Encrypted files cannot be edited collaboratively in Excel Online co-authoring
- −Mac and Web versions sometimes warn about compatibility with desktop encryption
- −Heavy macro workbooks may break if VBA is signed after encryption is applied
- −Users without the password see a confusing generic error rather than helpful message
Complete Checklist: How to Merge Cells in Excel Safely Before Locking
- ✓Audit the workbook for broken formulas, circular references, and stale links before applying any protection
- ✓Save a backup copy of the unprotected file in a separate folder labeled with today's date
- ✓Decide which threat you are defending against: accidental edits, unauthorized viewing, or formula theft
- ✓Choose your password from a password manager and store it before applying encryption
- ✓Apply workbook-level encryption first using File, Info, Protect Workbook, Encrypt with Password
- ✓Unlock every cell with Ctrl+A then Format Cells then Protection tab to uncheck Locked
- ✓Re-lock only the specific cells, ranges, or columns that must not be edited by reviewers
- ✓Hide proprietary formulas by checking the Hidden box in the Protection tab of Format Cells
- ✓Protect each worksheet with Review then Protect Sheet, granting only the actions users genuinely need
- ✓Test the protection by closing, reopening, and attempting every blocked action as a non-admin user
Document Your Password in Two Places
Microsoft cannot recover a forgotten workbook password under any circumstance. Before clicking OK on the encryption dialog, store the password in both your password manager and a printed secure location like a fireproof safe. Forty percent of password recovery service requests Microsoft receives are denied because the encryption is mathematically irreversible.
Beyond the built-in menus, Excel exposes several advanced security features that most users never discover. Information Rights Management (IRM), accessible through File, Info, Protect Workbook, Restrict Access, integrates with Azure Active Directory to enforce per-user permissions that persist even after the file leaves your network. You can grant read-only access to a contractor, set an expiration date of thirty days, and revoke access remotely if the project ends early, all without ever sharing a password.
Digital signatures add a layer of authenticity rather than confidentiality. Under File, Info, Protect Workbook, Add a Digital Signature, you can sign the workbook with a certificate from your organization or a public certificate authority like DigiCert. Recipients see a red banner if anyone modifies the file after signing, which is essential for contracts, audited financial statements, and regulatory submissions. Signing does not encrypt the file; it only proves the file has not been altered since you signed it.
For macro-heavy workbooks, VBA project protection prevents others from viewing or editing your code. Open the VBA editor with Alt+F11, right-click VBAProject, choose VBAProject Properties, go to the Protection tab, check Lock project for viewing, and set a password. Note that VBA passwords are even weaker than sheet passwords and can be removed in minutes with a hex editor, so do not rely on this for true IP protection. Instead, compile critical logic into a signed COM add-in or move it server-side.
Excel for the Web introduces a different security model. Files stored in OneDrive or SharePoint inherit cloud permissions, and encryption is handled at rest by Microsoft's BitLocker-based service-side encryption. You can still set a password on an .xlsx uploaded to OneDrive, but co-authoring is disabled for encrypted files because the cloud service cannot decrypt them to merge changes. The trade-off is real-time collaboration versus strong local encryption; pick one based on your priority.
Group Policy and Microsoft Intune give IT administrators centralized control over Excel security defaults. Policies like "Set default file format to .xlsx," "Require encryption for files marked confidential," and "Block opening of files from untrusted sources" can be deployed organization-wide. For environments handling personal data, configuring Office to automatically apply a sensitivity label based on content patterns, such as detecting Social Security numbers, prevents users from accidentally distributing unprotected files.
Another underused tool is the Document Inspector, found under File, Info, Check for Issues, Inspect Document. It scans for hidden rows, hidden columns, comments, personal metadata, and embedded objects, then offers to remove anything sensitive. Run the inspector before locking any file you share externally to avoid leaking author names, revision history, or hidden assumption sheets that the recipient could uncover with two clicks.
Finally, for the truly paranoid, combine Excel encryption with a separate file-level encryption tool like 7-Zip or VeraCrypt. Place the locked .xlsx inside an encrypted container, set a different password on the container, and share the container plus password through separate channels (email the file, text the password). This belt-and-braces approach defeats most realistic attacks, including those targeting the relatively weak password-protected ZIP format that .xlsx files use internally.

Dozens of free and commercial tools can break sheet-level passwords in under a minute and workbook-level passwords in days for weak passwords. Never rely solely on sheet protection for sensitive data. Always apply workbook encryption with a 14+ character passphrase, and store truly confidential information in a system designed for it, such as a database or DLP-protected file share.
Unlocking an Excel file you own is straightforward when you know the password: open the file, enter the password at the prompt, then go to File, Info, Protect Workbook, Encrypt with Password, clear the password field, and save. The encryption is removed and the file is once again plain .xlsx. To remove sheet protection, switch to the Review tab, click Unprotect Sheet, and enter the sheet password. For workbook structure protection, click Unprotect Workbook on the same tab.
What if you forgot the password? Microsoft's official answer is that the file is unrecoverable. In practice, third-party tools like Passware, Elcomsoft Advanced Office Password Recovery, and the free John the Ripper can attempt dictionary, brute-force, and rainbow-table attacks. Sheet passwords almost always fall in seconds because they use a 16-bit hash. Workbook encryption passwords from Excel 2007 and later are AES-256 protected and may be uncrackable in any reasonable time if the password is long and random, so prevention through a password manager is far more reliable than recovery.
Sharing locked files requires planning. Send the file through one channel (email attachment, OneDrive link, secure file transfer) and the password through a different channel (text message, phone call, Signal). Never include the password in the same email as the file; this is the single most common mistake and immediately defeats the encryption if the email is forwarded or intercepted. For ongoing collaboration, consider switching to a SharePoint library with permission-based access instead of password-protected files, since revoking SharePoint access is instant while a leaked password is forever.
Compatibility is another consideration. Excel 2007 through Microsoft 365 all use AES-128 or AES-256 encryption that is fully interoperable. Older formats like .xls use a much weaker RC4 cipher that is trivially breakable and should never be used for new files. If a recipient asks for an .xls version, decline and explain the security risk, or send a PDF export instead. Excel for Mac and Excel for iPad both support modern encryption, though the menu paths differ slightly.
If you regularly distribute the same template to many recipients with the same password, automate the process with a VBA macro: ActiveWorkbook.Password = "YourPassword" followed by ActiveWorkbook.Save. Trigger the macro on workbook close or from a custom ribbon button. For larger volumes, use PowerShell with the Microsoft.Office.Interop.Excel library to batch-encrypt hundreds of files overnight. Pair this with an Azure Automation runbook and you have an enterprise-grade pipeline that ensures no file leaves your environment unencrypted.
One final pattern worth knowing: temporary sharing links in OneDrive. Right-click the file in OneDrive, choose Share, click the link settings gear, set an expiration date, require a password, and disable downloads. The recipient can view the file in Excel Online without ever receiving a local copy, and access auto-revokes on the expiration date.
This eliminates the "file forever in someone's downloads folder" problem that plagues traditional password-protected distribution. Combined with audit logs in the Microsoft 365 admin center, you also get a record of every view, which is invaluable for compliance investigations. If your workbook also needs deduplication, run find duplicates in excel before sharing to ensure recipients see clean data.
Recovery best practices include keeping at least two unprotected backups in separate locations: one on an external drive or USB stick stored offline, and one in a different cloud account such as Dropbox or Google Drive. Encrypt the backups themselves with a different password to maintain security. Test your recovery process quarterly by opening a random backup and confirming the password still works. Many users discover their password manager has been corrupted only when they urgently need a file, so periodic drills prevent disasters.
Now that you understand every locking method, here is the practical decision framework most analysts and accountants use day-to-day. For internal collaboration on non-sensitive files, skip protection entirely and rely on version history in OneDrive or SharePoint. For files shared with one or two trusted colleagues who might accidentally edit formulas, apply sheet protection only, no password needed, just to prevent fat-finger mistakes. For files containing confidential data leaving your organization, always apply full workbook encryption with a strong passphrase shared out-of-band.
A useful mental model is the CIA triad: confidentiality, integrity, and availability. Encryption protects confidentiality. Digital signatures protect integrity. Backups protect availability. A truly secure workflow addresses all three, not just the first. Many small businesses lock files but never back them up, only to lose months of work when a hard drive fails. Locking and backing up are complementary, not alternatives, and modern cloud storage handles both automatically when configured correctly.
For templates you distribute widely, consider a two-password pattern: one to open (shared with all users) and a different one to modify (shared only with admins). Set this through File, Save As, Tools, General Options. Most users will be content with read access, and the small number who need to update the master template can do so without proliferating editable copies. This pattern works especially well for budget templates, performance review forms, and project status trackers.
If you teach or train others on Excel, dedicate an entire session to locking and protection. In our experience training thousands of finance analysts, the most common mistake is protecting the sheet without first unlocking the input cells, resulting in a completely read-only template that frustrates users. The second most common mistake is using the same weak password (often the company name plus a year) on every locked file, which means one leak compromises everything. Teach unique passwords from a password manager from day one.
For automation enthusiasts, Power Query and Office Scripts both work seamlessly with locked workbooks as long as the queries are refreshed by users who know the password. Office Scripts in Excel for the Web can be combined with Power Automate to build flows like "every Monday, encrypt last week's report and email it to the CFO with the password in a separate Teams chat." These no-code automations remove human error from the locking process entirely.
Finally, stay current with Microsoft's security updates. Excel's encryption has been strengthened multiple times: the jump from RC4 (.xls) to AES-128 in 2007 was massive, and the move to AES-256 with stronger key derivation in newer versions added more headroom against future attacks. Always save in the latest .xlsx format, keep Office updated through the Microsoft 365 channel, and avoid downgrading to legacy formats even when recipients request them. Educate stakeholders that old formats are themselves a security risk, often more dangerous than the inconvenience of upgrading.
Mastering Excel locking is one of the highest-ROI skills a knowledge worker can develop. It takes one afternoon to learn thoroughly, prevents an entire class of data breaches, and signals professionalism every time you share a file. Bookmark this guide, work through the checklist on a real workbook today, and you will never again wonder how to lock an Excel file properly. The next time a colleague sends you an unprotected confidential spreadsheet, you will be the one who quietly fixes it before it becomes tomorrow's incident report.
Excel Questions and Answers
About the Author
Attorney & Bar Exam Preparation Specialist
Yale Law SchoolJames R. Hargrove is a practicing attorney and legal educator with a Juris Doctor from Yale Law School and an LLM in Constitutional Law. With over a decade of experience coaching bar exam candidates across multiple jurisdictions, he specializes in MBE strategy, state-specific essay preparation, and multistate performance test techniques.