How to use AES Encrypt / Decrypt
The AES Encrypt / Decrypt tool encrypts text with AES-256-GCM using a password you provide, and decrypts it back. The key is derived from your password using PBKDF2 with 100,000 iterations and a random salt. The output bundles salt, IV, and ciphertext into a single portable Base64 string — all using the native Web Crypto API with no server uploads.
- Select the mode: Encrypt to protect text, or Decrypt to recover it.
- For encryption, paste your plaintext into the input field and enter a strong password.
- Click Encrypt to receive a Base64 ciphertext that embeds the salt and IV.
- Copy and store the ciphertext and remember your password — without it, decryption is impossible.
- To decrypt, switch to Decrypt mode, paste the Base64 ciphertext, enter the same password, and click Decrypt.
Your data never leaves your device — 100% private processing.
AES-256-GCM: authenticated encryption explained
AES-256-GCM (Advanced Encryption Standard, 256-bit key, Galois/Counter Mode) is an authenticated encryption algorithm that simultaneously provides confidentiality and integrity. The GCM tag (16 bytes appended to the ciphertext) allows the decryptor to detect any tampering — if the ciphertext is modified, decryption fails with an authentication error rather than returning corrupt plaintext. This is called AEAD (Authenticated Encryption with Associated Data). GCM is parallelisable and performs very well on modern hardware with AES-NI instructions. AES-256 uses a 256-bit key, requiring 14 rounds of substitution-permutation operations.
| Component | Size | Purpose |
|---|---|---|
| Salt | 16 bytes | Random input to PBKDF2 key derivation — unique per encryption |
| IV (nonce) | 12 bytes | Random initialisation vector for GCM — must never be reused with the same key |
| Ciphertext | Input length bytes | The encrypted message payload |
| GCM Tag | 16 bytes | Authentication tag that verifies integrity on decryption |
Password-based key derivation with PBKDF2
Passwords are low-entropy strings unsuitable for direct use as 256-bit AES keys. PBKDF2 (Password-Based Key Derivation Function 2) stretches a password into a cryptographic key by applying a pseudorandom function (HMAC-SHA256) many thousands of times with a random salt. The iteration count (100,000 in this tool) is deliberately high to slow down brute-force attacks: an attacker guessing passwords must run 100,000 HMAC operations per guess. The salt ensures that two identical passwords produce different keys, defeating rainbow-table attacks. Modern alternatives include Argon2 and bcrypt, which are memory-hard and slower for attackers, but PBKDF2 is available natively in all browsers through the Web Crypto API.
Worked examples
Encrypt text
Inputs: plaintext + password · AES-256-GCM
Result: Base64 bundle of salt + IV + ciphertext + tag
Round-trip decrypt
Inputs: ciphertext + the same password
Result: original plaintext recovered
Tamper detection
Inputs: ciphertext altered by one character
Result: decryption fails with an authentication error
Glossary
- AES-GCM
- Advanced Encryption Standard in Galois/Counter Mode — an authenticated encryption algorithm providing both confidentiality and integrity.
- PBKDF2
- Password-Based Key Derivation Function 2 — stretches a password into a cryptographic key using many iterations of a hash function.
- IV (nonce)
- Initialisation Vector — a random value used with the key to ensure that encrypting the same message twice produces different ciphertext.
- Salt
- A random value added to a password before hashing or key derivation to prevent rainbow-table attacks and ensure unique outputs.
- AEAD
- Authenticated Encryption with Associated Data — encryption that provides both confidentiality and integrity/authenticity in a single operation.
Related reading
Frequently Asked Questions
Why use AES Encrypt / Decrypt?
- Encrypt text with AES-256-GCM so any tampering is detected on decryption via the auth tag
- Derive a 256-bit key from a password using PBKDF2 with 100,000 iterations and a random salt
- Bundle salt, IV, and ciphertext into a single portable Base64 string for storage or transfer
- Decrypt any ciphertext produced by this tool using the same password to verify round-trips
Common use cases
- Encrypt a sensitive config snippet to share it securely over a messaging app
- Store an encrypted API key in a repository with the decryption password managed separately
- Test an AES-256-GCM decryption function in your backend by supplying a known ciphertext
- Produce an encrypted backup of environment variables before rotating them
- Verify that altering the ciphertext by one character causes decryption to fail with an auth error
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Related Developer Tools
Password Strength Tester
Test how strong a password is with an entropy score and estimated crack time. Get tips to improve it. Runs locally — Free and private.
HMAC Generator
Generate HMAC signatures with SHA-1, SHA-256, SHA-384, or SHA-512 and a secret key. Uses the Web Crypto API. Free and private.
Hash Generator
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes instantly in your browser. Free, private, and secure for quick checks.
Base64 Encoder & Decoder
Encode text or files to Base64, or decode Base64 strings back to text in seconds. Free, private, and fully in-browser now.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
Regex Tester
Test and debug regular expressions online. See live matches, capture groups, and replace output. Free, private, instant.
Explore all Developer Tools.