Logo
Back to Blog
Security August 15, 2026 7 min read

How to Password Protect a Text File on Windows and Mac

O

OmniWebKit Team

Security Tooling

Share:
Article Cover Image

You have a text file with something in it you would rather not explain — passwords, notes, a draft you are not ready to share. Anyone who opens your laptop can read it in one double-click. Password protect a text file properly and that stops being true.

The short answer first: Notepad cannot do it, and never could. Everything below is about what to use instead.

Can Notepad password protect a file? No, and here is why

Notepad is a text editor with no security features at all. There is no password option hidden in a menu, and the tutorials claiming otherwise are describing something else.

Most of them mean the Windows folder encryption checkbox, which is a completely different mechanism with its own conditions. A few describe a batch-file trick that renames folders. That one hides nothing from anyone who types the right command, and it has been losing people's files for years.

The same is true of TextEdit on a Mac, and of every plain text editor. Text files are the simplest format there is, which is exactly why nothing protects them by default.

How to encrypt a txt file on Windows 11, and the trap in it

Windows has built-in file encryption called EFS. Right-click the file, choose Properties, click Advanced, and tick "Encrypt contents to secure data".

It works, and it does less than people think. The key is tied to your Windows account, so the file opens with no password at all while you are logged in — it is protected from other accounts on the machine, not from you or anyone using your session.

Now the part that catches people out. EFS only exists on NTFS drives. Copy that file to a USB stick formatted as FAT32 or exFAT, and Windows quietly decrypts it on the way rather than warning you. The stick now holds a plain copy. We have watched people discover this the hard way, and it is not obvious behaviour.

Two more conditions worth knowing. EFS is missing from Windows Home editions, and if your account password is reset by an administrator rather than changed by you, the key can be lost with it — which puts you in the territory of losing access to your own file.

Using 7-Zip to password protect a folder or a single note

The archive route is the most portable one, and it works the same on Windows, macOS and Linux.

Install 7-Zip, right-click the file, choose Add to archive, set the format to 7z, pick AES-256 in the encryption box, and type a password. The result opens anywhere with the password and nowhere without it.

Tick "Encrypt file names" as well. Without it the archive still lists what is inside, so a file called bank-details.txt is visible to anyone who opens the archive without a password. That box is off by default and it is the single most missed setting in this whole process.

Avoid the older ZIP encryption if the software offers it. It is weak enough that consumer recovery tools break it, and the option often sits right next to the good one. If you want to build the archive in the first place, our bundle the files into an archive tool will do it, and you can encrypt the result afterwards.

The browser route, when you cannot install anything

Work laptops are the usual reason people end up here. No admin rights, no software requests, and a note that still needs protecting.

Our encrypt the file itself page takes any file, including a .txt, and hands back an encrypted copy with a password of your choosing. Nothing is installed and nothing is uploaded — the work happens in the tab. For a short note you would rather paste than save, the text encryption tool does the same job on the text directly.

The honest limits. It protects the file, not the machine — a managed laptop may already be watching what you type. And there is no recovery: forget the password and the note is gone, which is the same trade every real encryption tool makes.

What about the office applications already installed?

Word and Excel both password-protect their own documents properly, using real encryption rather than a flag. If your text is going to end up in a document anyway, saving it as a .docx with a password is a legitimate answer.

Two caveats. It is only strong in recent versions — files from the Office 2003 era use encryption that is trivially broken today. And it converts your plain text into a format that carries its own metadata: author name, edit history, revision times.

For a genuinely plain note, a wrapper around the original file keeps things simpler. Which mode that wrapper uses matters more than the key size, as we explain in which cipher mode to prefer.

Choosing between them

Match the method to what you are protecting against, because they are not interchangeable.

  • Other people using this computer. EFS is enough, as long as the file never leaves an NTFS drive.
  • A file that has to travel. An encrypted 7z archive, or the browser tool. Both survive being emailed or copied to a stick.
  • Cloud storage. Encrypt before it syncs, not after, and check the version history afterwards.
  • A stolen laptop. Whole-disk encryption, which is a different job from any of the above.

One habit matters more than the choice. Whatever you use, decrypt the result once and check it opens before deleting the original. Every method on this page has produced an unopenable file for somebody, usually because of a mistyped password rather than a flaw.

Protecting a text file without kidding yourself

The file is the easy part. Copies are the hard part — the draft in your email drafts folder, the version in the recycle bin, the backup that ran last night, the thumbnail cache.

Encrypting one file does nothing about any of those, and no tool on this page will tell you they exist. Find them and deal with them, then encrypt what remains. That is the whole job, and the encryption is the small half of it.

Frequently Asked Questions

Why does my encrypted file open normally on my own PC without a password?

+
That is Windows EFS working as designed, and it confuses almost everyone. The key is tied to your user account, so while you are logged in the file opens transparently. It only looks encrypted to other accounts, which is a much narrower protection than people assume.

I copied an EFS-encrypted file to a USB stick and it lost its protection. Why?

+
Because the destination was formatted as FAT32 or exFAT, and EFS only exists on NTFS. Windows silently decrypts on the way out rather than refusing. The plain file is now on the stick, which is the opposite of what you wanted.

Does hiding a file or marking it read-only help at all?

+
No. Both are flags that any file manager can toggle in two clicks, and neither changes a byte of the contents. They stop accidents, not people.

Is a password-protected ZIP good enough for a text file?

+
The AES-256 option in 7-Zip is genuinely sound. The catch is that unless you tick the header encryption box, anyone can see the filenames inside without the password — so an archive containing resignation-letter.txt announces itself.

What is the difference between BitLocker and encrypting one file?

+
BitLocker protects the whole disk against someone taking the drive out. It does nothing once the machine is running and unlocked, which is when most snooping happens. They solve different problems and using one is not a reason to skip the other.

Can I password protect a .txt file without any software at all?

+
Not with the file itself, no. Every route needs something: a Windows feature, an archive tool, an office application, or a browser page. The browser route is the only one that installs nothing and leaves nothing behind on a shared machine.

Does macOS have an equivalent of the Windows encrypt checkbox?

+
Not for single files. FileVault covers the whole disk, and for individual items the usual route is an encrypted disk image made in Disk Utility. It works well and it is a heavier tool than most people want for one note.

If I password protect a text file, is it safe in cloud storage?

+
Safer, with one large caveat about timing. If the plain version ever synced, the provider has it and probably keeps older versions for weeks. Encrypt first, then put the encrypted copy in the synced folder, and clear the version history of the original.

Why does my encrypted text file still show a preview in File Explorer?

+
Because a thumbnail or indexed excerpt was cached before you encrypted it, and the cache lives separately from the file. Clearing the thumbnail cache and rebuilding the search index removes it. It is a good reminder that a copy is rarely just one copy.

Can I encrypt a file that is already open in an editor?

+
You can start the process and you should not. Unsaved changes live in the editor rather than on disk, and some editors keep their own recovery copies elsewhere. Close the file, then encrypt, then check the result opens.

Tags

#Encryption#Windows#macOS#Files