SM4 Encrypt/Decrypt - Free Online Tool | PivaBox

Encrypt and decrypt data using SM4 — Chinese national standard block cipher (GB/T 32907)

How to Use SM4 Encrypt/Decrypt

  1. Enter or generate a 128-bit key (16 bytes) in hexadecimal format
  2. Select the encryption mode — ECB (simpler, less secure) or CBC (recommended, requires IV). For CBC mode, enter or generate a 128-bit IV (16 bytes)
  3. Choose Encrypt or Decrypt, enter your data, select the output format, and click the action button

Frequently Asked Questions

What is SM4?

SM4 is a block cipher standard published by the Chinese State Cryptography Administration as GB/T 32907. It is a symmetric block cipher with a 128-bit key and 128-bit block size, widely used in Chinese financial systems, government communications, and WAPI wireless security.

Does my data leave my device?

No. All encryption and decryption operations happen entirely in your browser. No data is ever sent to any server. The key, IV, and plaintext remain on your device at all times.

ECB vs CBC — which mode should I use?

CBC (Cipher Block Chaining) is recommended for most use cases. ECB (Electronic Codebook) encrypts each block independently, which can reveal patterns in the plaintext. CBC uses an IV to add randomness and prevents pattern leakage. Always use CBC unless you have a specific reason to use ECB.