SM4 Encrypt / Decrypt
Free online SM4 (Chinese national cipher) encryption and decryption. ECB/CBC modes, Base64 or HEX output, full UTF-8 support. Runs in your browser.
How to use
What it does
SM4 is a 128-bit block cipher published by China's State Cryptography Administration and widely used in finance and government systems. This tool supports ECB and CBC modes with hex or Base64 output, computed entirely in your browser.
Example
Set the key to 0123456789abcdeffedcba9876543210 (32 hex chars = 16 bytes), the plaintext to 你好,SM4!, choose CBC with IV fedcba98765432100123456789abcdef:
5c30dd7f8e5e03dfe9aa0ff955c989ea737e88cf97b7bffcc1237acd9458e08bSwitching "Output" to Base64 gives XDDdf45eA9/pqg/5VcmJ6nN+iM+Xt7/8wSN6zZRY4Is=.
Key & IV
The key is exactly 16 bytes: either ASCII (16 characters) or 32 hex chars. CBC also needs a 16-byte IV, and both sides must use the same IV.