How to Password Protect a Text File on Windows, Mac, or Online
Table of Contents
How to Password Protect a Text File on Windows
Option 1: Encrypt the containing folder (Windows Pro/Enterprise only)
Right-click the folder → Properties → Advanced → "Encrypt contents to secure data." This uses Windows EFS (Encrypting File System). The file is encrypted for your Windows user account. Anyone logged into your account can still open it — this protects against someone physically removing the drive, not against someone who has your Windows password.
Option 2: 7-Zip with AES-256
- Download 7-Zip (free, open source) at 7-zip.org
- Right-click your .txt file → 7-Zip → Add to archive
- Set Encryption method to AES-256
- Enter a password in the "Enter password" fields
- Check "Encrypt file names" for additional privacy
- Click OK
You get a .7z archive. The original .txt file should be deleted securely afterward (use Eraser or shift+delete is not enough for a truly sensitive file). To open, double-click the .7z and enter the password.
Option 3: Microsoft Word/Office
Paste your text into a Word document. File → Info → Protect Document → Encrypt with Password. Not a .txt file anymore, but it's a simple built-in option for users already in the Microsoft ecosystem.
How to Password Protect a Text File on Mac
Option 1: Disk Utility — Encrypted DMG
- Open Disk Utility (Applications → Utilities → Disk Utility)
- File → New Image → Image from Folder
- Select the folder containing your text file
- Set Encryption to "128-bit AES" or "256-bit AES"
- Enter a password when prompted
- Click Save
This creates a .dmg file that requires the password to mount. Strong and native, but you're encrypting a folder, not the file directly.
Option 2: TextEdit + Password-Protected Note in Notes App
Notes app on Mac allows password-protected notes (File → Lock Note). This is easy but ties you to the Notes app and iCloud sync.
Option 3: Terminal with openssl
openssl enc -aes-256-cbc -salt -pbkdf2 -in secret.txt -out secret.txt.enc
Enter a password when prompted. To decrypt:
openssl enc -aes-256-cbc -d -pbkdf2 -in secret.txt.enc -out secret.txt
Powerful but requires comfort with the command line. The -pbkdf2 flag is important — always include it for proper key derivation.
Sell Custom Apparel — We Handle Printing & Free ShippingHow to Password Protect Text Without Software (Browser-Based)
If you don't want to install software or if you're on a shared computer, browser-based AES-256 encryption is the fastest option:
- Open a browser-based text encryption tool
- Paste the contents of your text file into the Encrypt panel
- Enter a strong password
- Copy the encrypted output
- Save the cipher string to a new .txt file
The resulting file looks like random base64 text. Anyone who opens it without the password sees gibberish. To recover the original text, paste the cipher string into the Decrypt panel and enter the password.
Advantages over software methods:
- No installation required — works on any OS
- Nothing is uploaded to any server (browser-side processing)
- The cipher string can be emailed, pasted anywhere, or stored in cloud storage safely
- Works the same on Windows, Mac, Linux, Chromebook
Security Comparison: Which Method Is Actually Safest?
| Method | Encryption | Threats Protected Against |
|---|---|---|
| Windows EFS | AES-256 | Physical drive theft only |
| 7-Zip AES-256 | AES-256 | Drive theft + unauthorized file access |
| Mac Disk Utility DMG | AES-256 | Drive theft + unauthorized file access |
| openssl enc | AES-256 | Drive theft + unauthorized file access |
| Browser-based encryption | AES-256-GCM | Drive theft + file sharing + transmission |
| MS Word password | AES-128/256 | Drive theft + unauthorized file access |
All AES-256 methods are cryptographically equivalent — the algorithm is the same. The difference is what threats they protect against. Browser-based encryption adds the unique ability to transmit the cipher safely across any channel without special software on the receiving end.
Common Mistakes When Password Protecting Text Files
- Renaming the file extension — changing .txt to .jpg does not encrypt anything. Anyone can rename it back or open it with a hex editor.
- Zipping without a password — a .zip file without AES encryption is not password protected in any meaningful security sense.
- Using weak passwords — a 4-digit PIN or simple word makes any encryption trivially breakable via dictionary attack.
- Storing the password in the same location as the file — defeats the entire purpose.
- Not deleting the original after encryption — encrypted versions of files are useless if the plaintext original still exists alongside them.
Password Protect Your Text — Free, No Software Needed
Paste your text, set a password, get AES-256 encrypted output. Works in any browser on Windows, Mac, Linux, or mobile.
Open Free Text Encryption ToolFrequently Asked Questions
Can I password protect a .txt file directly in Notepad?
No, Notepad has no built-in encryption. Your options are: 7-Zip (encrypt the file), browser-based text encryption (encrypt the contents), or Disk Utility on Mac. There is no native "lock .txt file" feature in Windows Notepad.
Is a password-protected Word document actually secure?
Modern versions of Word (2007+) use AES-128 or AES-256. Older versions (pre-2003) used weak RC4 that can be cracked easily. For a modern .docx file with a strong password, the encryption is solid.
How do I share an encrypted text file with someone who doesn't have 7-Zip?
Either share the 7-Zip installer alongside the file, use browser-based text encryption (they just need a browser), or use PrivateBin/similar tools that allow encrypted sharing via URL.
Does encrypting a text file change its size significantly?
Slightly. AES-256 output is typically 1.3-1.5× the size of the plaintext for typical text content (due to base64 encoding). For text files, this is usually negligible.

