Skip to main content

XXTEA Encrypt & Decrypt

API reference

Encrypt or decrypt text with the XXTEA (Corrected Block TEA) cipher using a text or hex key, with base64 or hex output. Runs in your browser.

Input

XXTEA is a small legacy cipher with known weaknesses and no integrity check. Use it only to interoperate with existing systems (games, embedded firmware); choose AES for anything new.

Output

Result
Was this helpful?

More ways to use this tool

REST API

curl -X POST https://api.iotools.cloud/v1/tool/xxtea-encrypt-decrypt \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputText": "Hello, World!",
    "direction": "encrypt",
    "key": "1234567890abcdef",
    "keyFormat": "text",
    "format": "base64"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `xxtea-encrypt-decrypt` tool (XXTEA Encrypt & Decrypt) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Embed widget

<iframe
  src="https://iotools.cloud/embed/xxtea-encrypt-decrypt/"
  width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
  title="XXTEA Encrypt & Decrypt — iotools.cloud"
  sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
  allow="clipboard-write"
  style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>

Drop this into your own page — free, no key required, just a link back.

Cost per API/MCP callFrom 5 credits
Need more credits?View pricing

Also available with

Guides

Encrypt or decrypt text with XXTEA (Corrected Block TEA) entirely in your browser. Nothing you type — text or key — is uploaded.

How to use it

  1. Paste your text (or the ciphertext, when decrypting) into Input.
  2. Pick Encrypt or Decrypt.
  3. Enter the Key — up to 16 bytes, as Text (UTF-8) or Hex. Shorter keys are zero-padded to 16 bytes.
  4. Choose whether ciphertext is Base64 or Hex. Output appears in Result.

Compatibility

This follows the convention shared by most XXTEA libraries (including the popular xxtea-node, PHP, Python and Lua ports): the data is zero-padded to a multiple of 4 bytes, and its real length is appended as a final little-endian 32-bit word so decryption can strip the padding. Ciphertext is therefore always a multiple of 4 bytes, at least 8. Keys longer than 16 bytes are rejected rather than silently truncated.

Should I still use XXTEA?

Not for new work. XXTEA is a compact legacy cipher with published attacks and no integrity check. It is common in games and embedded firmware, which is what this tool is for. Use AES for anything new.

Troubleshooting

  • "Decryption failed" — the key differs from the one used to encrypt, or the ciphertext was altered or truncated.
  • Different output from another tool — check the key format and the padding convention; some libraries omit the appended length word.
xxteateablock teacorrected block teaencryptdecryptcipherlegacy encryption

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.