Skip to content
Toolcroft

AES Encrypt / Decrypt Online (AES-256-GCM)

Password & Security

Encrypt and decrypt text in your browser with a passphrase or raw AES key. Web Crypto keeps your text and keys on your device.

Educational use only. This tool is for learning and hobbyist purposes. Do not use it to protect compliance-regulated or enterprise data. If you lose your passphrase or raw key, the data cannot be recovered.
Key type

PBKDF2-SHA-256 derives an AES-256 key with a fresh 16-byte salt for each encryption.

AES-256-GCM · PBKDF2-SHA-256 · 310,000 iterations · salt (16 bytes) + IV (12 bytes) + ciphertext and tag · All computation stays in your browser via the Web Crypto API.

How to use this tool

  1. Select Encrypt or Decrypt mode.
  2. Choose Passphrase (PBKDF2) or Raw key; choose the same key type when decrypting.
  3. Enter your plaintext (to encrypt) or paste the Base64 ciphertext (to decrypt).
  4. Enter the passphrase or the matching Hex/Base64 raw key.
  5. The result appears instantly. Click Copy to copy it.

How AES-256-GCM encryption works

AES (Advanced Encryption Standard) is a symmetric block cipher standardized by NIST in 2001. This tool uses AES in GCM (Galois/Counter Mode) with a 256-bit key. GCM is an authenticated encryption mode: it not only keeps the data secret but also detects any tampering or corruption. If the passphrase is wrong or the ciphertext is modified, decryption fails with an explicit error rather than silently returning garbage.

Passphrase key derivation with PBKDF2

In the default passphrase mode, your passphrase is not used directly as an AES key. PBKDF2-SHA-256 runs for 310,000 iterations with a fresh random 16-byte salt to derive an AES-256 key. This makes brute-force attacks against weak passphrases much slower. The salt is stored alongside the ciphertext so the same key can be re-derived at decryption time.

Raw AES keys

For interoperability, select Raw key and enter a strict Hex or Base64 encoding of exactly 16, 24, or 32 bytes. Those lengths select AES-128, AES-192, or AES-256. Raw keys are imported as-is: no PBKDF2 derivation runs and no salt is included in the blob. Use randomly generated key bytes; do not paste a password as a raw key. Choose the matching key type again when decrypting, because the blob does not identify its own key scheme.

Output format

The Base64 output encodes one of two binary layouts. Passphrase mode uses salt (16 bytes) | IV (12 bytes) | ciphertext + auth-tag. Raw-key mode uses IV (12 bytes) | ciphertext + auth-tag. Both formats use a 16-byte GCM tag at the end. Use the same key type and key material selected during encryption when decrypting.

Privacy

All encryption and decryption happens locally in your browser using the built-in Web Crypto API. No data is ever sent to a server. The source code is visible in your browser's developer tools.

When to use this tool

This tool is appropriate for personal use cases such as:

  • Protecting a personal notes file before storing it in cloud storage.
  • Encrypting sensitive text before sharing it over an insecure channel.
  • Learning how AES-256-GCM and PBKDF2 work in practice.

It is not designed for production secrets management. For application secrets, API keys, and credentials at scale, use dedicated secrets management systems such as HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault, which offer audit logging, access controls, and automatic rotation.

Security recommendations

The strength of AES-256-GCM encryption ultimately depends on the passphrase. Even with 310,000 PBKDF2 iterations, a short or common passphrase is vulnerable to offline brute-force attacks:

  • Use at least 20 characters. A randomly generated passphrase of that length has more entropy than a typical memorable phrase.
  • Avoid dictionary words and predictable patterns. Names, dates, and common phrases are brute-forced quickly.
  • Use a password manager to generate and store the passphrase - do not rely on memory for high-value data.
  • Store the passphrase separately from the ciphertext. If an attacker obtains both, the data is compromised.

Output format breakdown

The Base64 output encodes a binary envelope. The passphrase layout includes the salt before the IV; the raw-key layout starts with the IV because the key is supplied directly. In both formats, the final 16 bytes are the authentication tag, and the ciphertext length excludes that tag.

BytesFieldPurpose
Passphrase: 0–15Salt (16 bytes)Random value used by PBKDF2; not present in raw-key blobs
Passphrase: 16–27; raw key: 0–11IV (nonce, 12 bytes)AES-GCM initialization vector; unique per encryption
After IV to end − 16CiphertextEncrypted payload
Last 16 bytesAuth tagGCM authentication tag; detects tampering

Passphrase decryption needs the blob and passphrase. Raw-key decryption needs the blob, the original raw key, and the selected Hex or Base64 representation. After successful encryption or decryption, the tool displays the parsed salt when present, IV, ciphertext byte length, and tag. AES-GCM verifies the tag before any plaintext is shown; a wrong key or modified tag returns an error without envelope details.

Frequently asked questions

What algorithm does this tool use?

Both key types use authenticated AES-GCM. Passphrase mode derives an AES-256 key using PBKDF2-SHA-256 with 310,000 iterations and a random 16-byte salt. Raw-key mode imports exactly 16, 24, or 32 bytes as AES-128, AES-192, or AES-256 without derivation.

Is this tool safe for real secrets?

This tool is for educational and hobbyist use. For compliance-regulated or enterprise data, use dedicated, audited software. The biggest risk with any passphrase-based encryption is losing the passphrase - there is no recovery mechanism.

Why does the same plaintext produce different ciphertext each time?

Both key types generate a fresh random 12-byte IV for each encryption. Passphrase mode also generates a random 16-byte PBKDF2 salt. Reusing an IV with the same AES-GCM key can compromise security.

Can I decrypt elsewhere?

Yes, if the other implementation uses the same key scheme and parameters. Passphrase blobs are Base64 of salt(16) | IV(12) | ciphertext+tag and use PBKDF2-SHA-256 with 310,000 iterations to derive AES-256. Raw-key blobs are Base64 of IV(12) | ciphertext+tag and use the supplied 16-, 24-, or 32-byte key directly. Choose the matching key type when decrypting; blobs do not contain a marker that identifies the scheme.

Can I enter a password as a raw key?

No. Raw-key mode accepts strict Hex or Base64 encodings of exactly 16, 24, or 32 random key bytes. It does not stretch a password or include a salt. Use passphrase mode for human-chosen passwords.

What happens if I lose my passphrase?

The data is unrecoverable. There is no backdoor and no way to derive the passphrase from the ciphertext. Always store your passphrase safely before encrypting important data.

Browse all password & security