AES Encrypt & Decrypt
Encrypt or decrypt text with AES-256-CBC using a passphrase.
Reviewed by the ToolNestr Editorial Team — July 2026
How AES-256-CBC encryption works
AES-256-CBC (Advanced Encryption Standard with a 256-bit key in Cipher Block Chaining mode) is a symmetric encryption algorithm widely used to secure sensitive data. When you provide a passphrase, this tool does not use the passphrase directly as the encryption key. Instead, it feeds the passphrase through PBKDF2 (Password-Based Key Derivation Function 2) along with a random 16-byte salt. PBKDF2 applies the HMAC-SHA256 pseudorandom function 100,000 times — a process called key stretching — to produce a cryptographically strong 256-bit key that resists brute-force and rainbow-table attacks.
Once the key is derived, the tool generates a random 16-byte initialization vector (IV). CBC mode XORs each plaintext block with the previous ciphertext block before encryption, ensuring that identical plaintext blocks produce different ciphertext blocks. The encryption output bundles the random salt, the IV, and the ciphertext into a single Base64-encoded string. To decrypt, the tool extracts the salt and IV from the encoded output, re-derives the key from your passphrase and the stored salt, and reverses the CBC decryption.
Because the salt is random and different each time you encrypt, even encrypting the same text with the same passphrase yields a completely different output every time. This property — called semantic security — prevents attackers from recognizing repeated plaintexts or mounting dictionary attacks. The IV ensures that each block's encryption depends on all preceding blocks, providing diffusion across the entire message.
Use cases
Securing confidential messages
Encrypt sensitive messages before sending them over email, chat, or other channels where privacy is a concern. Share the passphrase separately through a secure channel.
Protecting personal notes
Encrypt passwords, API keys, or personal notes before storing them in your notes app or cloud storage. Only someone with the correct passphrase can read the content.
Learning cryptography
Experiment with AES-256 encryption to understand how symmetric key algorithms, IVs, salt, and key derivation functions work together to protect data.
Tips for using AES Encryption
Strong passphrases are essential
The security of your encrypted data depends entirely on the passphrase. Use a long, unique passphrase with a mix of uppercase and lowercase letters, numbers, and symbols. Avoid common phrases, dictionary words, or reused passwords. A passphrase like "correct-horse-battery-staple" is far stronger than "P@ssw0rd!" — length beats complexity.
Encrypted output includes a salt and IV
The output string is a Base64 encoding that bundles three components: a 16-byte random salt (used for PBKDF2 key derivation), a 16-byte initialization vector (used for CBC mode), and the ciphertext itself. Both the salt and IV are essential for decryption but are safe to store alongside the ciphertext — their purpose is to prevent pattern recognition, not to hide secrets.
Base64 encoding is not encryption
The encrypted output is Base64-encoded for safe transport and storage in text-based systems (JSON, databases, emails). Base64 is a binary-to-text encoding, not a cipher — it does not provide any security on its own. Always use a proper encryption algorithm like AES-256-CBC to protect data confidentiality.
The same passphrase always works
As long as you have the correct passphrase and the complete encrypted output string (including the salt and IV), you can decrypt the data on any device at any time. The tool is deterministic with respect to the passphrase and the stored salt — encryption uses random salt and IV, but decryption re-derives the exact same key from the stored salt.
PBKDF2 key derivation
PBKDF2 applies a pseudorandom function (HMAC-SHA256) to the passphrase along with a salt value, repeating the process 100,000 times to produce a derived key. This stretching increases the computational cost of brute-force attempts, making each password guess significantly slower.
AES key sizes compared
AES supports three key sizes: 128-bit, 192-bit, and 256-bit. AES-256 offers the highest security level with 14 rounds of encryption operations (vs 10 for AES-128 and 12 for AES-192). The 256-bit key provides 2^128 security against quantum attacks using Grover's algorithm.
CBC mode properties
Cipher Block Chaining mode chains each plaintext block with the previous ciphertext block before encryption. This ensures that identical blocks encrypt differently depending on their position, providing diffusion and preventing pattern-based attacks.
Related tools
RSA Key Generator · Bcrypt Hash Checker · SHA-256 Hash Generator
What is AES-256-CBC?
AES (Advanced Encryption Standard) is a symmetric block cipher adopted by the U.S. government in 2001 after a multi-year public competition organized by NIST. The algorithm was developed by cryptographers Joan Daemen and Vincent Rijmen and was originally called Rijndael. AES processes 128-bit blocks using a substitution-permutation network and is available in three key sizes: 128-bit, 192-bit, and 256-bit. AES-256 uses 14 rounds of transformation, providing the highest security level in the AES family.
CBC (Cipher Block Chaining) is one of several block cipher modes of operation. In CBC mode, the encryption of each block depends on all previous blocks through an XOR operation with the previous ciphertext block. This creates a chain of dependencies that prevents attackers from seeing patterns across blocks. CBC requires an initialization vector (IV) for the first block, which must be random and unique for each encryption session but does not need to be kept secret.
PBKDF2 (Password-Based Key Derivation Function 2) is defined in RFC 2898 and is a key derivation function designed to transform human-memorable passphrases into cryptographically strong keys. By adding a random salt and iterating the hash function thousands of times, PBKDF2 makes it computationally expensive for attackers to test large numbers of candidate passphrases. The iteration count of 100,000 is considered a reasonable baseline in 2025 — for higher security requirements, 600,000 or more iterations may be appropriate.
Symmetric vs asymmetric encryption
AES-256-CBC is a symmetric encryption algorithm — the same key is used for both encryption and decryption. This makes it very fast and suitable for encrypting large amounts of data, but it requires both parties to share the same secret key. Asymmetric encryption (like RSA) uses a public key for encryption and a private key for decryption, eliminating the key-sharing problem at the cost of slower performance. This tool implements symmetric encryption, while our RSA Key Generator demonstrates asymmetric techniques.
In practice, many secure systems use a hybrid approach: asymmetric encryption securely exchanges a symmetric session key, which is then used with AES for bulk data encryption. This combines the key-exchange advantages of asymmetric cryptography with the speed of symmetric encryption. The passphrase-based approach used in this tool is a simplification suitable for individual use where both operations happen on the same device.
Enter your text
Type or paste the plaintext you want to encrypt or the ciphertext you want to decrypt in the input area.
Enter your passphrase
Type the passphrase used to derive the encryption key. For encryption, choose a strong passphrase. For decryption, enter the same passphrase used during encryption.
Encrypt or decrypt
Click Encrypt to produce a Base64 ciphertext or Decrypt to recover the original plaintext. Copy the result with one click.
| Parameter | Value |
|---|---|
| Algorithm | AES-256-CBC |
| Key derivation | PBKDF2 with HMAC-SHA256 |
| PBKDF2 iterations | 100,000 |
| Salt size | 16 bytes (128 bits) |
| IV size | 16 bytes (128 bits) |
| Key size | 256 bits (32 bytes) |
| Block size | 128 bits (16 bytes) |
| Output format | Base64 (salt + IV + ciphertext) |
Security level and best practices
AES-256 is approved by NIST and the NSA for securing classified information up to the TOP SECRET level. The 256-bit key provides 128-bit security against quantum cryptanalysis (Grover's algorithm halves the effective key size), which remains far beyond the reach of any known or anticipated computing capability. Combined with PBKDF2 key stretching and a random salt, this tool provides strong protection against brute-force, dictionary, and rainbow-table attacks.
For maximum security, always use a unique passphrase that you have never used elsewhere. Consider using a password manager to generate and store a long random passphrase. Never share your passphrase over the same channel as the encrypted data. The encrypted output can be safely stored or transmitted alongside metadata — the salt and IV are public values by design and do not weaken the encryption.
Remember that client-side encryption in a web browser has inherent limitations. The passphrase and plaintext exist in browser memory and could potentially be exposed by browser extensions, keyloggers, or compromised browser processes. For highly sensitive data, consider using dedicated encryption software such as GPG, VeraCrypt, or an operating-system-level encrypted volume.
Frequently asked questions
Is my data sent to a server?
No — encryption and decryption happen entirely in your browser using the Web Crypto API.
What encryption standard is used?
AES-256-CBC (Advanced Encryption Standard, 256-bit key in Cipher Block Chaining mode).
Can you decrypt without the password?
No — AES-256 is computationally infeasible to brute force with current technology.
What format is the encrypted output?
Base64-encoded ciphertext with the IV and salt prepended (salt+IV+ciphertext format).