AES Encrypt & Decrypt: Secure AES-256-GCM Encryption in Your Browser
Learn how to encrypt and decrypt text with AES-128/192/256-GCM using just a password β PBKDF2 key derivation, authenticated encryption, and 100% client-side processing.
Table of Contents
Every day, developers paste sensitive text into online tools β API keys, database credentials, personal notes, confidential messages. With most "free encryption" websites, that text travels to a server you don't control, and you simply hope it isn't logged or leaked. Our AES Encrypt & Decrypt tool takes a different approach: it runs entirely in your browser using the native Web Crypto API, so your plaintext and password never leave your device. Not once, not ever.
The tool implements AES-GCM β the same authenticated encryption standard trusted by HTTPS and encrypted messaging apps β in key sizes of 128, 192, and 256 bits. You pick a password, and the tool derives a cryptographic key from it with PBKDF2 and 150,000 iterations, generates a fresh random salt and IV for every encryption, and returns a single base64 string you can store or share. A built-in authentication tag also gives you tamper detection: if anyone modifies one character of the ciphertext, decryption fails loudly instead of silently returning corrupted data.
In this guide, you'll learn how to use the tool, what happens under the hood each time you encrypt, which key size to choose, and how to fit AES-GCM into real workflows like sharing secrets in chat or protecting .env values in repositories.
Why Use AES Encrypt & Decrypt?
- 100% client-side processing. All cryptography runs in your browser via crypto.subtle β no server round-trip, no logging, no storage.
- Authenticated encryption. AES-GCM attaches an authentication tag to every ciphertext, so modified or corrupted data is detected and rejected on decryption.
- Strong key derivation. Your password is stretched through 150,000 PBKDF2 iterations, dramatically raising the cost of offline brute-force attacks.
- Fresh randomness every time. A new random 16-byte salt and 12-byte IV are generated per encryption, so encrypting the same text twice produces completely different outputs.
- Flexible key sizes. Choose AES-128, AES-192, or AES-256 (the default) with one click.
- Simple, portable output. One clean base64 string β easy to paste into notes, emails, or config files.
Key Features
| Feature | Details |
|---|---|
| Modes | Encrypt or Decrypt, with a Swap button to flip direction |
| Key sizes | AES-128 / AES-192 / AES-256 (256-bit default) |
| Key derivation | PBKDF2 with 150,000 iterations |
| Randomness | Fresh 16-byte salt + 12-byte IV per encryption |
| Output format | Base64 of salt || IV || ciphertext + auth tag |
| Authentication | AES-GCM authenticated encryption with tamper detection |
| Convenience | Copy-to-clipboard and clear buttons |
| Privacy | 100% client-side via the Web Crypto API |
- Mode toggle with Swap. Round-tripping a message to verify it works takes seconds.
- Password-based workflow. No raw key files or hex strings β one strong password is all you need.
- Self-contained ciphertext. Salt and IV travel inside the base64 output, so the string plus your password is all that's required to decrypt later.
How to Use
- Open the AES Encrypt & Decrypt tool in your browser.
- Choose your mode β Encrypt to protect text or Decrypt to recover it β and select a key size if you want something other than the AES-256 default.
- Type or paste your text into the input area, then enter a strong password. This password is the only secret protecting your data.
- Click the encrypt button. The tool derives a key with PBKDF2, generates a fresh salt and IV, and produces a base64 string containing salt || IV || ciphertext + tag.
- Copy the result and store or share it. To reverse the process, switch to Decrypt mode, paste the string, enter the same password, and recover your text.
Understanding AES-GCM Encryption
AES-GCM (Galois/Counter Mode) is the modern gold standard for symmetric encryption. It combines two operations in one pass: CTR-mode encryption, which transforms plaintext into ciphertext under a secret key, and GHASH authentication, which computes a tag over the ciphertext and IV. On decryption, the tool recomputes the tag and compares it β if even one bit of the ciphertext, IV, or salt has been altered, the tags won't match and decryption is rejected. That is "authenticated encryption": confidentiality and integrity in one operation, eliminating the bit-flipping and padding-oracle attacks that plague unauthenticated modes like CBC.
The tool never uses your password directly as the key β human passwords have far less entropy than a 256-bit key allows. Instead, it runs the password through PBKDF2 with 150,000 iterations and a random salt. Each iteration applies a hash round, so an attacker guessing your password must perform the full 150,000-round derivation for every candidate. The salt also defeats precomputed rainbow tables and ensures the same password produces different keys each time. The iteration count adds a fraction of a second for you while multiplying an attacker's cost enormously β a deliberate, worthwhile trade.
The salt and IV serve different purposes. The 16-byte salt feeds key derivation, guaranteeing a unique key even when you reuse a password. The 12-byte IV feeds the encryption itself, so identical plaintexts encrypt differently every time β without it, an observer could spot patterns. Both are regenerated with secure randomness on every encryption, and neither needs to be secret, only unique. That's why the output packs everything into base64(salt || IV || ciphertext + tag): the string is fully self-contained, and all you need alongside it is your password.
Which key size should you choose? AES-128 is unbroken and marginally faster β fine for performance-sensitive use. AES-192 sits in between. AES-256 is the default for its larger security margin, including against theoretical quantum attacks, where Grover's algorithm effectively halves key strength β leaving AES-256 at roughly 128-bit quantum resistance versus 64 bits for AES-128. In the browser, the performance difference is negligible, so there's little reason to leave the default.
One honest caveat: AES-256 itself is uncrackable, but your password is the weakest link. PBKDF2 slows guessing; it cannot save password123. Pair the tool with a long, unique passphrase β our Password Generator can create one β and the system becomes practically unbreakable.
Practical Use Cases
Sharing secrets over chat and email
Send a colleague a credential, but chat and email aren't end-to-end encrypted and their servers keep logs. Encrypt the secret first, send the base64 string over chat, and share the password through a different channel β a phone call, say. Even if the chat log leaks, the ciphertext alone is useless.
Protecting notes before cloud storage
Cloud note apps can read what you store. Encrypt journal entries, recovery seed phrases, or medical notes with AES-256 before they touch the cloud. They sync fine as opaque base64 blobs, and you decrypt locally only when needed β turning "trust us" storage into zero-knowledge storage.
Encrypting .env values in repositories
Config files leak through accidental commits or misconfigured CI logs. Instead of committing raw DATABASE_URL=postgres://user:secret@... lines, encrypt the sensitive values and commit the base64 output. Keep the password in your team's secrets manager, and a fully leaked repository exposes nothing usable.
Teaching and demoing cryptography
The tool is a perfect sandbox for understanding authenticated encryption. Encrypt the same message twice and watch the outputs differ entirely (fresh salt and IV). Flip one character in the base64 string and decrypt β tamper detection kicks in and fails cleanly. Abstract textbook concepts become visible in seconds.
Best Practices
- Use a long, unique password. Aim for a random 20+ character passphrase from a password manager or our Password Generator.
- Never reuse passwords across secrets. One leaked password shouldn't cascade into all your encrypted data.
- Stick with AES-256. The default gives maximum security margin at negligible cost.
- Never share the password over the same channel as the ciphertext. Ciphertext by email, password by phone β otherwise you've moved the secret, not protected it.
- Verify decryption before deleting plaintext. Test-decrypt once and confirm the output matches before you delete the original.
- Remember: there is no password recovery. A lost password means lost data β the client-side design means we never see it. Store it somewhere safe.
Start Encrypting Today
Sensitive text doesn't have to travel naked across the internet or sit readable in a cloud folder. With AES Encrypt & Decrypt, you get AES-256-GCM authenticated encryption, PBKDF2 with 150,000 iterations, and fresh random salts and IVs β all in a tool that runs completely in your browser and sends nothing to any server. No accounts, no installs, no trust required.
The next time you're about to paste an API key into a chat window or commit a credential to a repo, take ten seconds to encrypt it first. Your secret is then protected by the same standard that secures global internet traffic β and your data never has to leave your device again.
Related Tools You Might Like:
- Password Generator β Create strong, random passwords to use as encryption keys.
- Bcrypt Generator β Hash passwords securely for authentication and storage.
- HMAC Generator β Generate keyed-hash message authentication codes for data integrity.
Happy encrypting!