Encrypt Files with AES-256-GCM in Your Browser

To encrypt a file with AES-256-GCM in your browser is to turn the file into ciphertext on your own machine, with a key derived from a password you choose, before the file goes anywhere — to a cloud drive, an email attachment, a USB stick. The encryption runs in the page, in WebCrypto, and the file and the password never leave the browser. That matters because a file is not like a message you can retype: it is the secret itself. A chat can describe AES-GCM, but it cannot encrypt your real file, and pasting the file into a chat or uploading it to a random "encrypt online" site to get it encrypted is handing the plaintext to a stranger first. You can encrypt and decrypt files in the File Encryptor, entirely in your browser, with no size cap.

Your file is the secret — never paste it into a chat or upload it to a random site

People are careful with passwords and careless with files, and files are the worse leak. A password can be changed; a file usually cannot be un-read. A tax return, a contract draft, a scan of an ID, a folder of family photos — each one carries information that stays sensitive for years, and once a copy leaves your machine you cannot call it back. That is the first rule of this article: never paste a file into a chat, and never upload it to a site whose only credential is that it says "encrypt online". The service that encrypts your file for you has, by definition, seen the plaintext. If it is breached, sold, or simply logging uploads, the encryption it applied afterwards is decoration.

Browser-local encryption reverses that order. The file is read by the page, encrypted chunk by chunk on your machine, and only the ciphertext ever leaves — to your downloads folder, and from there wherever you choose to put it. The site never receives the file, the password, or the key, because there is no server side to receive them: the tool is a static page. The same logic is why this tool exists at all instead of being a chatbot answer. A chatbot can explain AES-GCM perfectly and still cannot encrypt your actual file, and the moment you paste the file in so that it can, you have given the plaintext to the very party you were trying to protect it from. If a workflow needs the file itself, the work has to happen where the file already is — on your machine.

AES-256-GCM in plain language: one key, a fresh check on every chunk

AES-256-GCM is two guarantees in one algorithm, and both matter for files. The "AES-256" part is the cipher: a 256-bit key scrambles each block of data so thoroughly that, with a key nobody can guess, the ciphertext reveals nothing about the plaintext. The "GCM" part is the authentication: for every chunk of the file, the algorithm computes a 16-byte tag that is a fingerprint of that chunk, its position, and the key. Decryption recomputes the tag and compares it; if a single byte was changed — a flipped bit in transit, a wrong password, a chunk swapped with one from another file — the tag does not match and decryption refuses, instead of silently handing you corrupted data.

That second guarantee is why GCM beats the older CBC mode for files, and why it is worth understanding the difference. CBC encrypts each block chained to the previous one, but it has no built-in way to tell whether the ciphertext was tampered with: an attacker who can flip bits in a CBC file can change the decrypted output in predictable ways, and the classic padding-oracle attacks against CBC are exactly this weakness being exploited. With CBC you need a separate HMAC to detect tampering, and getting that construction right is where implementations go wrong. GCM builds the check in — every chunk carries its own tag, verified before its plaintext is trusted — so there is no second mechanism to bolt on and no padding to attack. One key, one algorithm, confidentiality and authentication together.

Password or keypair? When a shared password is the right tool

There are two honest ways to encrypt a file for someone else, and they solve different problems. A password is a shared secret: you and the recipient agree on it — ideally out of band, in person or over a channel the file itself will not travel on — and the file can be opened by anyone who knows it. A keypair, the PGP model, is asymmetric: you encrypt to the recipient's public key, only their private key opens it, and nobody needs to agree on a secret beforehand. The keypair wins when you cannot safely share a secret, when the recipient must be exactly one person, and when you want signatures that prove who sent the file. It loses on setup: keys to generate, store, back up, and revoke, and a recipient who must already have one.

The password wins whenever the setup cost of a keypair is the reason encryption does not happen at all — which, for most people and most files, is the common case. A file for your future self, a backup on a drive you do not fully trust, a document for a colleague you can hand a password to in person: these need no key infrastructure, just a strong password and a format the recipient can open. Use the File Encryptor for those. When the recipient is a stranger, when the file must be attributable to you, or when you need to encrypt to several people without sharing one secret among them, use the PGP Suite instead — it is the same site, the same browser-local rule, and the right tool for messages and identity. Choosing the password tool when you needed the keypair tool is a real mistake; choosing the keypair tool and then never encrypting anything because the setup defeated you is the more common one.

Why other tools cap files at 10 MB — and how streaming removes the cap

If you have ever tried to encrypt a file online, you have met the cap: 10 MB, sometimes less, and anything bigger is refused. The cap is not stinginess. Most tools read the whole file into memory, encrypt it in one pass, hold the whole ciphertext in memory, and then offer it as a download — four copies of a large file sitting in RAM at once, plus the browser's own limits on how big a single in-memory blob can be. A 2 GB video would need gigabytes of memory to encrypt that way, and on a modest machine it simply fails. So the tool caps the input at a size it can survive, and large files are left unencrypted.

The fix is to stop holding the whole file at once. The encryptor reads the file in 1 MiB slices, encrypts one slice, writes its ciphertext out, and forgets the slice before reading the next — peak memory stays near one megabyte no matter how large the file is. On Chromium and Edge, the output goes through the File System Access API, so each encrypted chunk is written to disk as it is produced: true streaming, with no whole-file buffering anywhere in the pipeline. Firefox and Safari do not offer that API yet, so there the chunks are collected into a download at the end — the page says so plainly, and for very large files on those browsers the honest advice is to use a Chromium browser for the job. The 1 MiB chunk size is fixed by the file format, not a setting: it is what the decryptor expects, and keeping it fixed is what keeps every file this tool produces readable by any other implementation of the format.

The format, documented: your file is not locked to this site

An encrypted file you cannot open without the website that made it is a hostage, not a backup. So the container format is documented in full on the tool page, and this section is the short version. A .sysxenc file starts with the eight magic bytes SYSXENC1, then a two-byte header length, then a JSON header: the format version, the KDF name and iteration count, a random 16-byte salt, the 1 MiB chunk size, the original filename, the plaintext size, the SHA-256 of the plaintext, and a timestamp. The body is a sequence of chunks, each a four-byte ciphertext length, a fresh random 12-byte IV, and the ciphertext with its 16-byte GCM tag. The key comes from your password through PBKDF2-SHA-256 with 600,000 iterations — the count OWASP recommends — and every chunk is authenticated with additional data that binds it to this file and its position: the exact header bytes plus the chunk index, so a chunk reordered or spliced in from another file fails its tag check.

The point of writing all of that down is that anyone can implement a reader, and the Python decryptor below is the proof. It uses only the standard library plus the cryptography package, reads the header, re-derives the key, decrypts chunk by chunk verifying each tag, and finally checks the SHA-256 of the plaintext — exactly what the browser tool does. It was run against files this format produced, including a multi-megabyte file, an empty file, a wrong password, and a tampered file, and it behaved correctly in each case. One honest limitation: the OpenSSL command line cannot decrypt this chunked format directly, because it has no way to express per-chunk IVs, additional authenticated data, and tags. That is a property of the format's design, not a secret, and this article will not pretend otherwise — use the script below, or any AES-GCM implementation, instead.

The failure modes: what encryption cannot save you from

The first failure mode is the one the tool warns about most loudly, because there is no fix for it: lose the password and the file is gone. There is no recovery, no "forgot password" link, no master key held somewhere — the key is derived from your password and nothing else, and without it the ciphertext is indistinguishable from random bytes. Write the password down somewhere safe, separate from the file, before you delete the original. The second failure mode is a weak password. PBKDF2 with 600,000 iterations slows guessing, but it cannot make "password123" strong: an attacker who gets the file can guess offline, as fast as their hardware allows, with no server to lock them out. Use a long passphrase you can remember, not a short password you can type quickly.

The third and fourth failure modes are about what encryption does not cover. The header stores the original filename, the file size, and the creation time in the clear — the content is secret, the metadata is not. If the filename itself is sensitive, rename the file before encrypting, and consider running it through the Document Cleaner first, since documents carry their own metadata inside: author names, edit history, embedded thumbnails. And no encryption helps on a compromised device. If the machine you encrypt on is already running malware, it can read the file before encryption and the password as you type it. Encryption protects a file in transit and at rest; it does not protect a file on a machine that is already owned. That is not a reason to skip encryption — it is the reason to know exactly what it buys you.

Decrypt a .sysxenc file with Python

#!/usr/bin/env python3
"""Decrypt a SYSXENC v1 file produced by the SysOSX file encryptor.

Format (SYSXENC v1), as documented at
https://www.sysosx.com/tools/file-encryptor/ :
  header: 8-byte magic b"SYSXENC1", u16BE header length, header JSON bytes
          {"v": 1, "kdf": "PBKDF2-SHA256", "iter": 600000,
           "salt": <base64, 16 bytes>, "chunkSize": 1048576,
           "name": <original filename>, "size": <plaintext bytes>,
           "sha256": <hex of plaintext>, "created": <ISO timestamp>}
  body:   chunks, each u32BE ciphertext length (ciphertext INCLUDING the
          16-byte GCM tag) + 12-byte random IV + ciphertext+tag.
          The last chunk may be shorter; an empty file has zero chunks.
  AAD per chunk: the exact header JSON bytes + u32LE chunk index.
  KDF: PBKDF2-HMAC-SHA-256, 600,000 iterations, 256-bit key.

Requires the `cryptography` package:  pip install cryptography

Note: OpenSSL's command-line tool cannot decrypt this chunked format
directly — it has no way to express per-chunk IVs, AAD, and tags — so
use this script (or any AES-GCM implementation) instead.

Usage:
  python3 sysxenc_decrypt.py encrypted.sysxenc decrypted.bin
  python3 sysxenc_decrypt.py encrypted.sysxenc decrypted.bin --password hunter2
  (without --password, the password is read securely from the terminal)
"""

import argparse
import base64
import getpass
import hashlib
import json
import struct
import sys

MAGIC = b"SYSXENC1"
HEADER_LEN_FMT = ">H"   # u16 big-endian
CHUNK_LEN_FMT = ">I"    # u32 big-endian
CHUNK_INDEX_FMT = "<I"  # u32 little-endian
IV_LEN = 12
TAG_LEN = 16
KEY_LEN = 32


def _read_exact(f, n, what):
    data = f.read(n)
    if len(data) != n:
        raise ValueError(f"truncated file: could not read {what}")
    return data


def decrypt_file(in_path, out_path, password):
    with open(in_path, "rb") as f:
        magic = _read_exact(f, 8, "magic")
        if magic != MAGIC:
            raise ValueError(
                f"bad magic {magic!r}: not a SYSXENC v1 file")
        (header_len,) = struct.unpack(
            HEADER_LEN_FMT, _read_exact(f, 2, "header length"))
        header_bytes = _read_exact(f, header_len, "header JSON")
        header = json.loads(header_bytes.decode("utf-8"))
        if header.get("v") != 1:
            raise ValueError(
                f"unsupported format version: {header.get('v')!r}")
        if header.get("kdf") != "PBKDF2-SHA256":
            raise ValueError(
                f"unsupported KDF: {header.get('kdf')!r}")
        iterations = int(header["iter"])
        salt = base64.b64decode(header["salt"])
        chunk_size = int(header["chunkSize"])
        expected_size = int(header["size"])
        expected_sha256 = header["sha256"]

        key = hashlib.pbkdf2_hmac(
            "sha256", password.encode("utf-8"), salt, iterations, KEY_LEN)

        # Imported here so a bad file fails fast with a format error,
        # not an ImportError.
        from cryptography.hazmat.primitives.ciphers.aead import AESGCM

        aesgcm = AESGCM(key)
        hasher = hashlib.sha256()
        written = 0
        index = 0
        with open(out_path, "wb") as out:
            while True:
                len_bytes = f.read(4)
                if len(len_bytes) == 0:
                    break  # end of body
                if len(len_bytes) != 4:
                    raise ValueError(
                        f"truncated file: chunk {index} length field")
                (ct_len,) = struct.unpack(CHUNK_LEN_FMT, len_bytes)
                iv = _read_exact(f, IV_LEN, f"chunk {index} IV")
                ct_and_tag = _read_exact(
                    f, ct_len, f"chunk {index} ciphertext")
                aad = header_bytes + struct.pack(CHUNK_INDEX_FMT, index)
                try:
                    plain = aesgcm.decrypt(iv, ct_and_tag, aad)
                except Exception as exc:
                    raise ValueError(
                        f"chunk {index} failed authentication: "
                        "wrong password or tampered file") from exc
                out.write(plain)
                hasher.update(plain)
                written += len(plain)
                index += 1

        if written != expected_size:
            raise ValueError(
                f"size mismatch: header says {expected_size} bytes, "
                f"decrypted {written}")
        if hasher.hexdigest() != expected_sha256:
            raise ValueError(
                "SHA-256 mismatch: decrypted content does not match "
                "the header digest (file tampered or corrupt)")
        return header


def main(argv=None):
    parser = argparse.ArgumentParser(
        description="Decrypt a SYSXENC v1 (.sysxenc) file.")
    parser.add_argument("input", help="encrypted .sysxenc file")
    parser.add_argument("output", help="where to write the plaintext")
    parser.add_argument("--password",
                        help="password (if omitted, prompted securely)")
    args = parser.parse_args(argv)
    password = args.password
    if password is None:
        password = getpass.getpass("Password: ")
    try:
        header = decrypt_file(args.input, args.output, password)
    except (ValueError, OSError, KeyError) as exc:
        print(f"error: {exc}", file=sys.stderr)
        return 1
    print(f"decrypted {header.get('name', args.input)} "
          f"({header['size']} bytes, {header['sha256'][:12]}..., "
          f"SHA-256 verified)")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Sources

Frequently asked questions

Does my file or my password ever leave my browser?

No. The encryption runs in the page using the WebCrypto API, the file is read in 1 MiB slices on your machine, and the password is used only to derive the key locally. There is no upload step, no server side, and no account — the tool is a static page. The only thing that leaves the browser is the ciphertext, when you download it. If you want to confirm this, open your browser's network tab while encrypting: you will see no request carrying the file.

What happens if I forget the password?

The file is unrecoverable. The key is derived from your password by PBKDF2 and nothing else — there is no copy of the password, no recovery key, and no way for the site to reset it, because the site never sees it. A wrong password does not produce a corrupt file: decryption fails its authentication check and tells you so, with no output written. Keep the password somewhere safe and separate from the encrypted file before you delete the original.

Can I decrypt a .sysxenc file without this website?

Yes. The SYSXENC v1 format is fully documented on the tool page — header layout, chunk layout, the AAD rule, and the KDF parameters — and the Python decryptor in this article implements it with the standard library plus the cryptography package. It was verified against files the tool produced. The one thing you cannot use is the OpenSSL command line: it has no way to express per-chunk IVs, AAD, and tags, so it cannot decrypt this chunked format directly.