---
title: "SM4 Encryption: GM/T Block Cipher Toolkit - AllTools"
description: "Encrypt/decrypt with SM4 (GM/T 0002) in ECB, CBC, CFB, OFB and CTR modes with tunable key and IV — operations stay local for compliance."
canonical_url: "https://tool.warmday.wang/en/crypto/sm4"
meta:
  author: AllTools
  keywords: "online tools, AllTools, free online tools, developer tools, image tools, PDF tools, text tools, unit converter, no login, browser-based tools"
  "og:description": "Encrypt/decrypt with SM4 (GM/T 0002) in ECB, CBC, CFB, OFB and CTR modes with tunable key and IV — operations stay local for compliance."
  "og:image": "https://tool.warmday.wang/img/og-cover.png"
  "og:image:alt": "AllTools Logo"
  "og:image:height": "630"
  "og:image:width": "1200"
  "og:title": "SM4 Encryption: GM/T Block Cipher Toolkit"
  "twitter:image": "https://tool.warmday.wang/img/og-cover.png"
---

> Index of every page on this site: [llms.txt](https://tool.warmday.wang/llms.txt)

# **SM4 Block Cipher**

SM4 Chinese commercial symmetric block cipher algorithm, block and key length both 128 bits, supports ECB/CBC modes.

## **Configuration**

**Encryption Mode**

**Output Format**

## **Key**

Key must be 32 hex characters (16 bytes)

## **Encrypt**

## **Decrypt**

## **Instructions**

#### **About SM4**

SM4 is a commercial symmetric block cipher released by the State Cryptography Administration of China, with 128-bit block and key lengths, supporting ECB and CBC modes. Comparable in security to AES-128, widely used for data encryption in transit.

#### **Mode Description**

SM4/ECB: Electronic Codebook mode, each block encrypted independently, same plaintext produces same ciphertext, suitable for short data encryption; SM4/CBC: Cipher Block Chaining mode, each block XORed with previous ciphertext block before encryption, requires initialization vector (IV), more secure, recommended. This tool's CBC mode uses the first 16 bytes of the key as IV by default.

#### **Steps**

1\. Select encryption mode (ECB/CBC); 2. Enter plaintext and key (16 characters); 3. In CBC mode, also enter IV (16 characters); 4. Click 'Encrypt' or 'Decrypt'.

#### **Notes**

Key must be exactly 16 characters (128 bits); in CBC mode, IV must also be 16 characters; ECB mode is not suitable for encrypting large amounts of data (same plaintext blocks produce same ciphertext blocks); CBC mode is more secure and recommended.

## **Related tools**

More from the same category · Encryption

[**MD5 Hash**Generate 32-char MD5 digests for text and files to verify integrity and detect content changes locally.](https://tool.warmday.wang/en/crypto/md5) [**Hash Calculator**MD5, SHA-1, SHA-256, SHA-512 digests for text and files in one pass for checksums.](https://tool.warmday.wang/en/crypto/hash) [**Base64 Converter**Base64 encode/decode for text, UTF-8 and images, with Data URL output for inline embedding.](https://tool.warmday.wang/en/crypto/base64) [**Symmetric Encryption**Encrypt/decrypt with AES, DES, 3DES, RC4 and SM4, configurable mode, padding, key and IV, fully client-side.](https://tool.warmday.wang/en/crypto/symmetric) [**RSA Tools**Generate RSA key pairs (1024-4096 bit), encrypt/decrypt and sign with PKCS#1 v1.5 or PSS, browser-side.](https://tool.warmday.wang/en/crypto/rsa) [**PGP Tools**Generate OpenPGP keys, encrypt, decrypt and sign text or files with GnuPG-compatible ASCII-armored output.](https://tool.warmday.wang/en/crypto/pgp)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://tool.warmday.wang/#organization","name":"AllTools","alternateName":"AllTools - 全能工具箱","url":"https://tool.warmday.wang/","logo":{"@type":"ImageObject","url":"https://tool.warmday.wang/img/logo.png","width":512,"height":512}},{"@type":"WebSite","@id":"https://tool.warmday.wang/en#website","url":"https://tool.warmday.wang/en","name":"AllTools","inLanguage":"en","publisher":{"@id":"https://tool.warmday.wang/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://tool.warmday.wang/en?q={search_term_string}"},"query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tool.warmday.wang/en/crypto/sm4#webpage","url":"https://tool.warmday.wang/en/crypto/sm4","isPartOf":{"@id":"https://tool.warmday.wang/en#website"},"inLanguage":"en","name":"SM4 Encryption: GM/T Block Cipher Toolkit","description":"Encrypt/decrypt with SM4 (GM/T 0002) in ECB, CBC, CFB, OFB and CTR modes with tunable key and IV — operations stay local for compliance."},{"@type":"SoftwareApplication","@id":"https://tool.warmday.wang/en/crypto/sm4#app","name":"SM4 Encryption: GM/T Block Cipher Toolkit","description":"Encrypt/decrypt with SM4 (GM/T 0002) in ECB, CBC, CFB, OFB and CTR modes with tunable key and IV — operations stay local for compliance.","url":"https://tool.warmday.wang/en/crypto/sm4","applicationCategory":"SecurityApplication","operatingSystem":"Web","inLanguage":"en","isPartOf":{"@id":"https://tool.warmday.wang/en/crypto/sm4#webpage"},"offers":{"@type":"Offer","price":"0","priceCurrency":"CNY"}},{"@type":"BreadcrumbList","@id":"https://tool.warmday.wang/en/crypto/sm4#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://tool.warmday.wang/en"},{"@type":"ListItem","position":2,"name":"Crypto & Security","item":"https://tool.warmday.wang/en/crypto"},{"@type":"ListItem","position":3,"name":"SM4 Encryption","item":"https://tool.warmday.wang/en/crypto/sm4"}]}]}
```

## Sitemap

See the full [sitemap](https://tool.warmday.wang/sitemap.md) for all pages.
