[HOW TO ENCRYPT A TEXT FILE]

Plain text is the least protected format there is — and usually the one holding the most sensitive things.

A .txt file has no security of its own. Any program, backup process or person with access to the disk reads it directly, and it is fully indexed by desktop search. That matters more than it sounds, because text files are where passwords, licence keys, API tokens, server notes and recovery codes tend to accumulate.

Encrypting one is quick. The method depends on whether you need the file itself protected, or just want to move its contents somewhere safely.

[TWO DIFFERENT PROBLEMS]

Sorting this out first saves choosing the wrong tool.

  • You want the file protected on disk. Encrypt the file itself, producing an encrypted file you keep in place of the original. Use the file encryption tool, 7-Zip, or GPG.
  • You want to send the contents to someone. Encrypt the text itself into a block you can paste into an email or chat. Use the text encryption tool — no attachment required, and nothing for a mail gateway to strip.

[METHODS]

In your browser

For the file: open the file encryption tool, select your .txt, set a password, download the encrypted result. For the contents: paste into the text encryption tool and copy the encrypted block. Both run locally with no upload.

7-Zip (Windows)

Right-click → 7-Zip → Add to archive, format 7z, set a password, tick Encrypt file names. Text compresses extremely well, so the encrypted archive is often a fraction of the original size.

GnuPG (command line)

gpg -c notes.txt produces notes.txt.gpg using symmetric encryption with a passphrase. Decrypt with gpg -d notes.txt.gpg. Ideal if you already use GPG or want something scriptable.

A password manager instead

Worth considering seriously. If the text file exists to hold credentials, the better answer is usually not to encrypt it but to move its contents into a password manager, which handles encryption, sync and access control. Then delete the file.

[WHAT DOES NOT COUNT AS ENCRYPTION]

  • Notepad has no encryption feature. Neither does TextEdit. Saving with a different extension changes nothing.
  • Base64 encoding is not encryption. It looks scrambled and is reversible by anyone in seconds. The same goes for hex, ROT13 and URL encoding.
  • Hiding the file, or marking it hidden, protects nothing. It is a display setting.
  • A ZIP without a password is not encrypted. Compression is not protection — the contents extract freely.
  • Legacy ZIP encryption (ZipCrypto) is broken. If your archiver offers a choice, select AES-256.

[AFTER ENCRYPTING: DELETE THE ORIGINAL PROPERLY]

This step is skipped more often than any other, and it undoes the work. An encrypted copy alongside the readable original protects nothing.

  • Delete the plaintext file and empty the recycle bin
  • Check cloud sync — Dropbox, OneDrive and Google Drive keep version history, and the plaintext may persist there after local deletion
  • Check your editor's backup and swap files (notes.txt.bak, ~notes.txt, .notes.txt.swp)
  • Remember that desktop search may have indexed the contents; the index is a copy of your data
  • On an SSD, ordinary deletion does not overwrite the data, though full-disk encryption such as BitLocker or FileVault makes remnants unreadable

[HOW TO ENCRYPT A TEXT FILE]

Encrypt a .txt file with a password so its contents cannot be read.

  1. Decide what you are protecting. Encrypt the file itself if it must stay protected on disk. Encrypt the contents into a text block if you only need to send them to someone.
  2. Choose a tool. Use browser-based encryption for no install, 7-Zip on Windows, or GnuPG with gpg -c on the command line.
  3. Set a strong password. Use a long passphrase or a generated password. Store it in a password manager immediately.
  4. Verify you can decrypt it. Decrypt the file once to confirm the password works before removing the original.
  5. Remove the plaintext. Delete the original file, empty the recycle bin, and check cloud version history and editor backup files for surviving copies.

[FREQUENTLY ASKED QUESTIONS]

How do I encrypt a .txt file?

Run it through an encryption tool: the browser-based file encryption tool on this site, 7-Zip on Windows with a password and the encrypt-file-names option, or gpg -c on the command line. Notepad itself has no encryption feature, so the file must be processed by a separate tool.

Can Notepad encrypt a text file?

No. Notepad has no encryption capability, and neither does TextEdit on macOS. Changing the file extension or saving in a different encoding does not protect the contents in any way.

How do I decrypt a text file?

Use the same tool that encrypted it, with the same password. A .gpg file needs gpg -d, a 7-Zip archive needs 7-Zip, and a .enc file from this site can be decrypted with the file decryption tool.

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

Yes, provided it uses AES-256 rather than the legacy ZipCrypto scheme, which has known attacks. In 7-Zip choose the 7z format, or select AES-256 explicitly if you are producing a .zip. Also enable filename encryption, since ZIP file listings are otherwise readable without the password.

Should I encrypt a text file or use a password manager?

If the file holds credentials, a password manager is the better tool. It encrypts at rest, syncs across devices, controls access and avoids leaving plaintext copies in editor backups or search indexes. Encrypt a text file when you need to move or archive the file itself.