Technical brief
How to encrypt a file
TAG51 lets you encrypt any file using an image as the key. This page explains how it works, what protects your data, and how you can verify that nothing leaves your device.
The short version
- Choose the file you want to protect.
- Choose the image that will act as the key.
- TAG51 turns the image into a 256-bit encryption key, encrypts the file, and saves a
.tag51container. - Keep the original image safe. To decrypt, you need the exact same file — even a single changed pixel produces a different key.
What happens inside the browser
Everything runs through the Web Crypto API, which is built into every modern browser. No external library re-implements AES or key derivation.
1. Read the image as raw bytes
The image is read with File.arrayBuffer(). TAG51 uses the exact bytes of the file — it never renders the image to a canvas, resizes it, or re-encodes it. A screenshot, social-media re-compress, or edited copy will not work.
2. Hash the image bytes
The raw bytes are hashed with SHA-256. The digest is used immediately and is never stored in the encrypted file or logged anywhere.
3. Derive the AES key
A fresh 32-byte random salt is generated with crypto.getRandomValues(). The SHA-256 digest and salt are run through HKDF-SHA-256 to produce a non-extractable AES-256 key. The key exists only inside the browser's crypto subsystem; JavaScript cannot read the raw key bytes.
4. Encrypt with AES-256-GCM
The file content, filename, and MIME type are packaged into an encrypted payload. A random 12-byte IV is generated for every encryption. AES-GCM adds a 128-bit authentication tag, so any tampering with the file is detected at decryption time.
The .tag51 container
The result is a raw binary file, not Base64 or JSON. The public header stores only what is needed to identify the format and run decryption:
- Magic bytes and container version
- Algorithm and key-derivation identifiers
- The salt and IV
- The ciphertext
The filename, MIME type, and original file bytes are encrypted inside the payload. They never appear in the public header. If the container is opened with a different image, the authentication tag check fails and the tool reports a wrong key or damaged file — it does not produce corrupted plaintext.
Local-only by design
- No upload to any server.
- No account, no database, no analytics of file contents.
- Keys and plaintext exist only in tab memory during the operation.
- Nothing is written to localStorage or sessionStorage.
You can verify this yourself: open your browser's Network tab, encrypt a file, and watch for outgoing requests. The only requests TAG51 makes are for the page itself and its static assets; your file and image never travel over the network.
Limits and warnings
- Maximum file size is 512 MB. Operations above 100 MB show a memory warning.
- If you lose the key image, the file is unrecoverable. TAG51 has no password recovery and no backdoor.
- Editing, compressing, or screenshotting the key image will usually break decryption. Store the original file in more than one safe place.
When this helps
Use TAG51 when you want a quick, private way to protect a single file without installing software or creating an account. Because the tool runs entirely in your browser, it works offline after the page has loaded and leaves no cloud trail.