Encrypt Your Data Files in Windows

GPG4WinYesterday, I wrote a post on how to encrypt your sensitive data files in Linux. Today, I am putting a similar tutorial for Windows users. The idea is that these days, it’s difficult to keep track of all the usernames and passwords for the various accounts we all have across multiple websites. Using the same password for each of them is dangerous and saving the passwords in an unencrypted file is even worse. So I keep these sensitive pieces of information in an encrypted data file. It’s pretty straightforward. Here is how you do it…

1. Install of GPG4Win

Go http://www.gpg4win.com and download the latest version of GPG4Win. There is a download link on the main page as shown below:


In my case, the installation file was saved on my desktop. Go there and double-click on the file to install it. A window similar to this one should show up:

GPG4Win install

Keep clicking on the Next button until you get through to the following page:

GPG4Win Step 3

Make sure to select the same items that you see selected on this window. Once set, follow through the Next buttons again without changing any default settings.

Once you get to the following page, you will have to check the checkbox at the bottom. Do so and click Next again until you get to the end of the installation process.

GPG4Win Root Certificate

Now you’re done with the installation. Let’s look into how to use this program.

2. Encrypt the Text File

Let’s assume we have a text file named mypasswords.txt in our Documents folder and we want to encrypt the file so that no one who doesn’t know the password will be able to read it. You might see your file in your Documents like this:

Secret file

I also opened the file to see the secret content of it that will be encrypted. To encrypt it, right click on the Start button and in the field just above the Start button, type the


command “cmd” (without the quotes). You should see something like the image on the left. Hit the Enter key on your keyboard and a command prompt will open.

We need to move to the Documents folder, so type “cd Documents” to do so as shown below:


Now we are ready to encrypt the mypasswords.txt file. The encryption is executed by typing:

gpg -c mypasswords.txt

Encrypt GPG4Win

Once you type that and hit Enter, you will be prompted for a password – twice. Type in your desired password and when asked, retype it to confirm it. This is the password you will need to decrypt the file. Without the password, you can’t read the file contents.

Now you will see that besides mypasswords.txt, there is also mypasswords.txt.gpg file in the folder. That is the encrypted version of the file. Now you should delete the mypasswords.txt unencrypted file so that no one without the password can access the file contents.

3. Decrypt the Text File

In order to read the content of the file, you need to execute the following command:

gpg -d mypasswords.txt.gpg

It will print out the content of the file on your screen like this:

Decrypted file GPG4Win

If instead of printing the file on the screen you want to save it decrypted in a mypasswords.txt file, you need to modify the above command like so:

gpg -d mypasswords.txt.gpg > mypasswords.txt

This will create the mypasswords.txt file for you to open and read or edit. Later when you make your edits, you can encrypt the file again and delete the unencrypted version.

Once you do this a few times, it will take you less than a minute to encrypt and decrypt a file. I do it all the time – it’s a matter of practice.

Congrats! Your sensitive data are much safer now!

Bookmark the permalink.