Laptop running Windows
Hannah Stryker / How-To Geek
To password protect your text file in Windows, download and install the free 7-Zip tool, then restart your PC. Locate your text file, right-click it, and select 7-Zip > Add to Archive. Enter your password in both "Enter Password" and "Reenter Password" fields. Then, select "OK."

If you’ve got a text file containing sensitive information, it’s a good idea to protect it with a password. While Windows hasn’t got a built-in feature to add password-protection to text files, you can use a free and open-source utility called 7-Zip to protect your files. Here’s how it works.

With 7-Zip, you basically create a compressed ZIP archive and add to it your TXT, LOG, RTF, DOCX, or any other kind of text file. You then password-protect this ZIP file, which results in locking your zipped text file. Later, you can use any archive viewer (including 7-Zip, WinRAR, WinZIP, etc) to view your text file as well as remove password-protection from your file.

Add Password Protection to Your Text File

To start protecting your text file, launch your preferred web browser on your Windows PC and open the 7-Zip site. Download and install this free tool on your PC, then restart your PC.

When your PC turns back on, launch File Explorer and find the text file you want to lock. Right-click this file, and in the menu that opens, choose 7-Zip > Add to Archive.

Select 7-Zip > Add to Archive.

You’ll see an “Add to Archive” window. Here, in the “Encryption” section, click the “Enter Password” field and type the password you want to use to protect your file. Then, enter the same password in the “Reenter Password” field.

Tip: If you want to make sure your ZIP file is secure, learn how to choose a strong password and remember it too.

When you’re done, at the bottom of the window, click “OK.”

7-Zip has created a password-protected ZIP archive in the same folder as your text file. Your text file is now locked inside this archive, and it will only open when you enter the correct password.

A password-protected ZIP file in File Explorer.

Note that your original text file is still present in the same folder. You’ll want to delete it so that other users can’t access it. Do that by right-clicking the file, pressing and holding down the Shift key, and choosing “Delete” in the menu. This permanently deletes your text file from your PC.

How to View Your Password Protected Text File

When you want to access your locked text file, all you have to do is open your password-protected ZIP archive using any archive opener tool. All tools work the same way and will prompt you to enter your password before opening your text file.

To open your ZIP with 7-Zip, locate your archive in File Explorer. Right-click the archive, and in the menu that opens, choose 7-Zip > Open Archive.

Note: If 7-Zip is set as the default archive viewer, you can double-click your archive to open it with the tool.

Select 7-Zip > Open Archive.

The 7-Zip window will display your text file. Double-click the file to open it.

Open the text file.

The app will ask you to enter your password. Click the “Enter Password” field, type your password, and press Enter or select “OK.”

If your password was correct, 7-Zip will open your text file. And that’s all.

How to Remove Password Protection From Your Text File

In the future, if you’d like to remove the password from your text file, simply bring your text file out of your locked ZIP archive.

To do that, right-click your archive and choose 7-Zip > Extract Here.

Select 7-Zip > Extract Here.

Type your password in the “Enter Password” field and press the Enter key or click “OK.”

Type password in "Enter Password" and select "OK."

7-Zip will extract your text file in the same folder as the archive file. You can now delete the archive if you no longer need it.

And that’s how you can easily and quickly protect the data in your text files on your Windows computer. Stay safe!

RELATED: How to Hide Files and Folders on Every Operating System

Profile Photo for Mahesh Makvana Mahesh Makvana
Mahesh Makvana is a freelance tech writer who specializes in writing how-to guides. He has been writing tech tutorials for over a decade now. He’s written for some of the prominent tech sites including MakeUseOf, MakeTechEasier, and Online Tech Tips.
Read Full Bio »