Home > Tools > AES / SM4 Encryption

AES / SM4 Encryption

Symmetric encryption using AES (128/192/256) in CBC, GCM, ECB modes and SM4-CBC Chinese national standard. All computation in-browser via Web Crypto API.

Presets:

AES encryption uses the browser's built-in Web Crypto API (hardware-accelerated where available). SM4 uses a pure JavaScript implementation per GMT 0002-2012.

Encryption output is Base64-encoded. For GCM mode, the 16-byte authentication tag is appended to the ciphertext before Base64 encoding. ECB mode does not use an IV.

How to Use

Encrypt: Select algorithm and key size, enter a hex key and IV (or click "Random Key + IV"), type plaintext, click Encrypt. The output is Base64-encoded ciphertext.

Decrypt: Paste Base64-encoded ciphertext into the input field, enter the same key and IV used for encryption, click Decrypt.

Key Format: AES-128 = 32 hex chars, AES-192 = 48 hex chars, AES-256 = 64 hex chars. IV = 32 hex chars for CBC/GCM. SM4 key = 32 hex chars.

Example Use Cases