Skip to content

Encrypt a File with a Password

Choose a photo, PDF or any other file, set a password, and download it locked as a .age file. It is encrypted on this device, a chunk at a time, so big files work and nothing is uploaded.

File or photo

Example

A locked message

This is what one looks like.

-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCBvdnlrTGlYUmtCaCtXV0pR
RUdsWEpBIDE4CkJLVWtDZmxqOFQ5VVluUFdEVGpSanRERkZRaGRHT2dBcUVqakw5
YmMzaHMKLS0tIGN3TzBySW13NXdsOGlkenhnYU5OUnVpVGZlL0E3QXBHd2Q1UUdP
MzlLdmsKxvSP5aQgEvXG2WMVZDdV8NCGe+QiUVcu5oLSGx2QTSI+mwZGPlKfHRoY
tQD/Q6Qe6LytmIq6H9J1/scUYke8JbJKTyYydNEru9E=
-----END AGE ENCRYPTED FILE-----

Made with the age app; it opens here too.

How this works: Method, 4 sources,

How this works

Method

Everything runs in your browser, in the open age format (v1) through typage, the official TypeScript age implementation. Your password is stretched with scrypt (N = 2^18, r = 8, p = 1, the age default) into a key that wraps a random 128-bit file key; the content is encrypted with ChaCha20-Poly1305 in 64 KiB chunks, so any change is detected. Files made here open with `age -d`; the tests use files made by the age command-line tool and the C2SP age test vectors.

Changes

  • Pages for each job: encrypt text, encrypt a file, decrypt, and what age is, each opening the tool on that job.
  • First published: text, photos and files, as a block, a file or a link, in the age format.

How we make toolsReport a mistake

How to password-protect a file

Choose the file, or drop it anywhere on the page. Photos show a small preview so you can check it is the right one; any other kind of file, from a scanned passport to a spreadsheet or a zip of a whole folder, shows its name and size. Set a password, or let Suggest pick five random words, then press Encrypt.

Download .age saves a copy named after the original with .age added, so holiday.jpg becomes holiday.jpg.age. The original file stays where it was: delete it yourself if the locked copy is meant to replace it. A small file can also be copied as a block of text or a link, which is handy for a single document you want to send in a chat.

To open it again, drop the .age file on this page and type the password. It comes back with its original name, and photos show on the page before you save them.

Big files, read a piece at a time

The file is never loaded into the page whole. It is read and encrypted in 64 KiB chunks, each sealed with its own check, in a background worker, so the page stays responsive while a long video or a big backup goes through. The progress bar shows how far it has got; Cancel stops it at once.

Because every chunk carries a tag, a file that was cut short or changed on the way fails to open with a clear message instead of giving back damaged content. A locked file is slightly larger than the original: about 150 bytes of header, plus 16 bytes for every 64 KiB chunk.

To lock a whole folder

Browsers hand pages one file at a time, so put the folder in a zip first: on Windows, right-click it and choose Send to, then Compressed (zipped) folder; on a Mac, right-click it and choose Compress. Then lock the zip here. Unlocked later, it opens like any zip, with the folder inside.

Good to know

  • age encrypts the payload in chunks of 64 KiB with ChaCha20-Poly1305, and a reader must report an error if the file ends without a valid final chunk. Source: The age file format, v1
  • Each file gets its own 128-bit file key, generated as 16 bytes of secure random output; the password only wraps that key. Source: The age file format, v1

Frequently Asked Questions

What kinds of files can I encrypt?

Any file at all: photos, PDFs, Word and Excel documents, videos, zips, backups. The tool doesn’t need to understand the file; it locks the bytes, and unlocking gives back exactly the same bytes.

Is there a size limit?

Not a fixed one. The file is read in 64 KiB chunks rather than all at once; the practical limit is how much your browser lets one page hold and save, which is far more on a computer than on a phone. The tests lock and unlock a 6 MB file byte for byte; for very large backups, the age app on a computer is the sturdier choice.

How does someone else open the .age file?

They open this page, drop the file on it and type the password; there is nothing to install. On a computer they can also use the free age command-line tool: age -d -o holiday.jpg holiday.jpg.age asks for the password and writes the original file.

Is this the same as a password-protected zip or PDF?

It does the same job for any kind of file. How strong a zip, PDF or Office password is depends on the app and the settings that made it, and the person opening it needs a compatible app. An age file uses one published scheme for every file, with the password stretched by scrypt so each guess is slow, and it opens in a browser.