AES/SM4 Symmetric Encryption Tool

Input
Output

Online symmetric encryption supporting AES / SM4 / ChaCha20. Encrypts and decrypts locally in the browser — data never leaves your device.

How to Use & FAQ5 steps · 8 Q&A

Symmetric Encryption (AES / SM4 / ChaCha20)

Online symmetric encryption supporting AES / SM4 / ChaCha20. Encrypts and decrypts locally in the browser — data never leaves your device.

How to Use

  1. Choose an algorithm and modeSelect AES / SM4 / ChaCha20 and the corresponding mode; prefer authenticated GCM when transmitting data or needing tamper protection.
  2. Generate or supply a keyClick "Generate random key" for a strong key, or paste an existing hex key. Make it random and store it safely.
  3. Enter the plaintextType the text to encrypt into the input box; any UTF-8 content is supported.
  4. Encrypt and inspect the resultClick Encrypt to get the ciphertext; the result usually bundles the algorithm, IV and ciphertext, all of which are needed for decryption.
  5. Copy, save, or verify in reverseCopy and store the ciphertext and IV separately; switch to Decrypt and paste ciphertext + key + IV to confirm it restores correctly.

FAQ

What is the difference between AES and SM4?

Both are symmetric block ciphers that use the same key for encryption and decryption. AES is an international standard, while SM4 is a Chinese national commercial cryptography standard. This tool supports both; AES is fine for most cases, and SM4 can be chosen when Chinese compliance is required.

How do I choose a more secure key length?

Prefer a longer key when possible (e.g. AES-256). SM4 has a fixed 128-bit key length. The key must be sufficiently random — using the tool's "generate random key" is far safer than inventing a phrase yourself.

Is my encrypted content uploaded to a server?

No. All encryption and decryption happens locally in the browser — plaintext, ciphertext and keys never leave your device. But remember: this tool is for learning and prototyping; do not use it for genuinely high-risk secrets.

How do I choose between ECB and CBC?

Prefer modes that use an IV (such as CBC, CTR, GCM). ECB does not use an IV, so identical plaintext blocks produce identical ciphertext and may reveal structure — the famous "penguin" image leak came from ECB. Avoid it for sensitive content.

Does the IV need to be kept secret?

The IV does not need to be secret, but it must be random and different for every encryption under the same key. Reusing an IV weakens security and can even cause serious problems in modes such as GCM. This tool generates a fresh IV each time and outputs it together with the ciphertext.

Can the data be decrypted if I lose the key?

No. Symmetric encryption has no backdoor; without the key (and IV) the plaintext cannot be recovered. Keep the key and IV safe — store them in a password manager rather than on a sticky note.

What is the difference between authenticated encryption (GCM) and ordinary encryption?

Ordinary encryption (e.g. CBC) only provides confidentiality and does not detect tampering; authenticated encryption such as GCM also verifies integrity, so any tampering makes decryption fail. Prefer GCM for data sent over a network.

Where should I store the key?

Keep the key separate from the ciphertext: do not put the key in the same folder or message as the encrypted file. Use a password manager, environment variables, or a dedicated key-management service (KMS).