A private, browser-based AES-GCM encryption utility
Encrypt and decrypt text locally without sending sensitive data to a server.
This project is a lightweight client-side encryption tool built with standard web technologies and the Web Crypto API. It lets you encrypt text with authenticated AES-GCM, export the ciphertext and encryption details, and decrypt the data again whenever you have the correct key and nonce.
There is no backend, account system, database, or build process. Encryption and decryption happen inside the browser.
Important: This tool does not store or recover encryption keys. If you lose the key, the encrypted data cannot be decrypted.
- AES-128, AES-192, and AES-256 encryption
- AES-GCM authenticated encryption with a 128-bit authentication tag
- Cryptographically secure random keys and 12-byte nonces
- UTF-8 text support, including multilingual text and emoji
- Base64 output for ciphertext, nonce, and key
- Decryption authentication that detects incorrect or modified data
- Import previously exported encryption data from JSON
- Export results as JSON or plain text
- Copy individual values or the complete encryption package
- Light and dark themes with persisted theme preference
- Drag-and-drop JSON import
- Keyboard shortcuts:
Ctrl/Cmd+Enter— run the active operationEsc— dismiss visible notifications
- Responsive layout with accessible form labels, tabs, alerts, and controls
- A random AES key is generated using
crypto.getRandomValues. - A unique 12-byte nonce is generated for the encryption operation.
- The plaintext is encoded as UTF-8 and encrypted with AES-GCM.
- The authentication tag is appended to the ciphertext by the Web Crypto API.
- The ciphertext, nonce, and key are displayed as Base64 values.
- During decryption, AES-GCM verifies the authentication tag before returning plaintext.
The nonce does not need to be secret, but it must be kept with the ciphertext. The encryption key must remain private.
Web Crypto features require a secure context. localhost is treated as secure by modern browsers, so serve the project with any local static server:
git clone https://github.com/mahinexe/AES-Encryption-Decryption.git
cd AES-Encryption-Decryption
python3 -m http.server 8000Open http://localhost:8000 in your browser.
You can also use another static server, such as VS Code Live Server or:
npx serve .- Open the Encrypt tab.
- Select an AES key size.
- Enter the plaintext.
- Select Encrypt Data.
- Store the generated key, nonce, and ciphertext together in a secure location.
- Open the Decrypt tab.
- Enter or import the Base64 ciphertext, nonce, and encryption key.
- Select Decrypt Data.
- The plaintext is shown only after authentication succeeds.
The JSON export contains the following fields:
{
"algorithm": "AES-GCM",
"keySize": 256,
"ciphertext": "Base64-encoded ciphertext and authentication tag",
"iv": "Base64-encoded 12-byte nonce",
"key": "Base64-encoded AES key"
}The keySize value may be 128, 192, or 256. The iv field is the AES-GCM nonce; it is named iv for compatibility with common encryption formats.
- Plaintext, ciphertext, keys, and nonces are processed locally in the browser.
- The application does not send encryption data to a server.
- No backend or analytics service is included.
- Only the selected light/dark theme is stored in
localStorage. - AES-GCM authentication rejects modified ciphertext, nonce, or key material.
- A fresh nonce is generated for every encryption operation.
- Treat the generated key like a password. Anyone who has it can decrypt the data.
- Do not paste keys or plaintext into untrusted websites or shared computers.
- Use HTTPS when hosting the application publicly.
- Verify the downloaded source and hosting environment before using the tool for highly sensitive information.
- This project is a browser utility, not a replacement for a managed secrets vault or key-management system.
| Item | Value |
|---|---|
| Algorithm | AES-GCM |
| Key sizes | 128, 192, or 256 bits |
| Default key size | 256 bits |
| Authentication tag | 128 bits |
| Nonce size | 96 bits / 12 bytes |
| Text encoding | UTF-8 |
| Binary encoding | Base64 |
| Runtime | Modern browser with Web Crypto API |
| Dependencies | Tailwind CSS CDN and Google Fonts |
Use a current version of Chrome, Edge, Firefox, or Safari with Web Crypto API support. The application should be served from localhost or an HTTPS origin; opening the file directly may prevent cryptographic APIs from working.
.
├── index.html # Application markup and accessibility structure
├── script.js # Encryption, decryption, validation, and UI behavior
├── style.css # Theme, layout, component, and animation styles
└── README.md # Project documentation
The project has no build step or package installation requirement. Edit the files directly and reload the local server.
Before opening a pull request:
- Run the app from a local server.
- Test encryption with each key size.
- Test decryption with valid and invalid data.
- Confirm modified ciphertext fails authentication.
- Check the layout in both themes and on mobile-sized screens.
No license has been added to this repository yet. Until a license is provided, all rights remain with the copyright holder.
Created and developed by Mohammodullah Al Mahin.

