File Encryptor (AES-256)
Lock any file with a password using AES-256-GCM, or unlock a file this tool encrypted. It runs in your browser, works on files of any size, and refuses cleanly when the password is wrong or the file has been changed.
How to Use
- Drop the file you want to lock, or click the box to choose it. An encrypted .enc file switches the page to Decrypt by itself.
- Type a password, then type it again in the second box. Four or more random words are stronger than a short password full of symbols.
- Press Encrypt. The key is derived from your password (about half a second), the file is encrypted in 1 MiB records and name.enc downloads.
- To open it later, drop the .enc file, type the same password and press Decrypt. A wrong password or a changed file is refused; nothing half-decrypted is ever written.
- Keep the password somewhere safe, such as a password manager. Without it the file cannot be opened by anyone, including us.
Worked Example
Encrypting a 10,000,000-byte file. The file is cut into 1 MiB (1,048,576-byte) records: ⌈10,000,000 / 1,048,576⌉ = 10, nine full ones and a last one of 10,000,000 − 9 × 1,048,576 = 562,816 bytes. Each record gets its own random 12-byte IV and a 16-byte tag, and the file starts with a 25-byte header, so the result is 25 + 10 × 28 + 10,000,000 = 10,000,305 bytes. The 305 extra bytes are 0.003% of the file.
Decrypting with one wrong letter. “correct horse battery stapler” instead of “staple” gives a completely different 256-bit key, so the tag of record 1 does not match and the tool stops before writing a single byte. Changing one bit inside the file gives the same refusal, at the record that was changed. An empty file still makes a valid 53-byte .enc file: the header plus one empty record (25 + 28).
The common mistake: a short password. Eight random lowercase letters allow 268 = 208,827,064,576 guesses. Four words picked at random from a 7,776-word list (the Diceware list, one word per five dice) allow 7,7764 = 3,656,158,440,062,976 — about 17,500 times as many, and easier to remember. The 600,000 rounds make each guess slower; they cannot make a guessable password safe.
Show Work
How It Works and the File Format
| Bytes | Field | Contents |
|---|---|---|
| 0–3 | Magic | 55 42 58 32 (“UBX2”) |
| 4–7 | Rounds | PBKDF2 iteration count, unsigned 32-bit big-endian (00 09 27 C0 = 600,000) |
| 8 | Chunk size | log2 of the record’s data size (14 hex = 20 → 1,048,576 bytes) |
| 9–24 | Salt | 16 random bytes for PBKDF2 |
| 25… | Records | 12-byte IV, then the ciphertext, then the 16-byte GCM tag; every record but the last holds exactly one chunk of data |
Background: AES, GCM and Slow Keys
AES is the Rijndael cipher by Joan Daemen and Vincent Rijmen, published by the US National Institute of Standards and Technology as FIPS 197 in November 2001 after an open five-year competition. It encrypts 16-byte blocks with a 128-, 192- or 256-bit key. On its own a block cipher only scrambles; a mode decides how a whole file is handled. Galois/Counter Mode (GCM), standardised in NIST SP 800-38D in 2007, turns AES into a stream cipher and adds a tag that checks the data and any “additional authenticated data”, so a wrong key or a changed byte is detected instead of producing garbage. GCM needs a different IV for every message under the same key; this tool draws 12 fresh random bytes per record.
A password is not a key: people choose short, guessable ones. PBKDF2 (RFC 2898 in 2000, now RFC 8018) stretches a password into a key by running HMAC thousands of times with a salt, so every guess an attacker makes costs the same work and precomputed tables are useless. How many rounds is “enough” keeps rising with computer speed; OWASP’s Password Storage Cheat Sheet currently gives 600,000 for PBKDF2-HMAC-SHA-256, which is what this version uses (the first version used 250,000).
About This Tool
This tool encrypts and decrypts files with a password using only the Web Crypto functions built into your browser: PBKDF2 for the key and AES-256-GCM for the data. It reads the file in 1 MiB slices, so large files do not have to fit in memory twice, and it checks every record’s tag on the way back, so you get either the exact original bytes or a clear refusal. The format is written down above, so your files never depend on this website. Files from the tool’s first version still open.
Everything happens on your device. The file and the password are not uploaded, stored or logged; the page does not even keep the password after you close it. It suits anyone who wants to put private documents on a cloud drive, a USB stick or an email without trusting the place they are stored.
Related tools: Password Generator, Hash Generator and File Inspector.
Frequently Asked Questions
How secure is this encryption?
The file is encrypted with AES-256 in GCM mode, which also checks that nothing was changed. The key comes from your password through PBKDF2-HMAC-SHA-256 with 600,000 rounds, the figure OWASP recommends for PBKDF2 with SHA-256, and a random 16-byte salt, so the same password gives a different key for every file. All of it is your browser’s built-in Web Crypto; the page contains no cipher code of its own. The weak point is the password: a short or guessable one can be found by trying candidates.
What happens if I forget the password?
The file cannot be recovered. The password is never stored or sent anywhere, there is no reset and no master key, and trying passwords is the only way in, at 600,000 rounds of HMAC-SHA-256 per guess. Store the password in a password manager before you delete the original file.
Can I decrypt the file without this website?
Yes. The format is documented on this page: a 25-byte header (“UBX2”, the round count, the chunk size and the salt), then records of a 12-byte IV, ciphertext and a 16-byte tag. Any language with PBKDF2 and AES-GCM can read it; we checked the page’s output by decrypting it with PHP’s hash_pbkdf2 and openssl_decrypt.
Does encryption hide the file name or size?
No. The download is named after the original (report.pdf becomes report.pdf.enc), so rename it if the name itself is private. The size shows too: the encrypted file is the original plus 25 bytes plus 28 bytes per started MiB, so a 10,000,000-byte file becomes 10,000,305 bytes. Put several files in a ZIP first to hide their names and sizes inside one encrypted file.
Will .enc files from the older version of this tool still open?
Yes. The first version wrote “UBX1” files: one AES-256-GCM piece with 250,000 PBKDF2 rounds. They are recognised and decrypted automatically (up to 1 GiB, because that format must be read in one piece). Encrypt the result again to move it to the current UBX2 format with 600,000 rounds and 1 MiB records.
How do I use the File Encryptor (AES-256)?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Before a cloud upload
Encrypt a 2 GiB tax archive before it goes to a cloud drive: 2,048 records, and the file grows by only 57,369 bytes.
Sending a file by email
Attach contract.pdf.enc and send the password another way, by phone or a messaging app, never in the same email.
A USB stick that might get lost
Keep scans of a passport and insurance documents on a stick as .enc files; whoever finds the stick sees only random bytes.
Opening old .enc files
Decrypt a file made by the first version (UBX1, 250,000 rounds) and encrypt it again with 600,000 rounds.
Last updated: