---
title: "Affine Cipher Tool, y = ax + b mod 26 Shift - AllTools"
description: "Apply the Affine map y=(ax+b) mod 26 to encrypt and decrypt text. A textbook substitution-cipher exercise for crypto labs and CTF — offline."
canonical_url: "https://tool.warmday.wang/en/crypto/affine"
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": "Apply the Affine map y=(ax+b) mod 26 to encrypt and decrypt text. A textbook substitution-cipher exercise for crypto labs and CTF — offline."
  "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": "Affine Cipher Tool, y = ax + b mod 26 Shift"
  "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)

# **Affine Cipher**

Affine Cipher encryption and decryption, E(x) = (ax + b) mod 26.

## **Key Parameters**

**Parameter a (must be coprime to 26)**

**Parameter b (shift)**

Valid a values: 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25 (coprime to 26)

## **Encrypt**

## **Decrypt**

## **Substitution Table**

**Plaintext**

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

**Ciphertext**

I

N

S

X

C

H

M

R

W

B

G

L

Q

V

A

F

K

P

U

Z

E

J

O

T

Y

D

### **Usage**

#### **Algorithm Principle**

Affine cipher is a monoalphabetic substitution cipher. Encryption: E(x) = (ax + b) mod 26, Decryption: D(y) = a⁻¹(y - b) mod 26, where a must be coprime to 26.

#### **Parameter Description**

Parameter a must be coprime to 26 (1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25), otherwise decryption is impossible; parameter b is the shift, range 0-25.

#### **Limitations**

Only processes English letters (a-z, A-Z); non-letter characters remain unchanged. Affine cipher has low security, suitable for educational demonstration only.

## **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/affine#webpage","url":"https://tool.warmday.wang/en/crypto/affine","isPartOf":{"@id":"https://tool.warmday.wang/en#website"},"inLanguage":"en","name":"Affine Cipher Tool, y = ax + b mod 26 Shift","description":"Apply the Affine map y=(ax+b) mod 26 to encrypt and decrypt text. A textbook substitution-cipher exercise for crypto labs and CTF — offline."},{"@type":"SoftwareApplication","@id":"https://tool.warmday.wang/en/crypto/affine#app","name":"Affine Cipher Tool, y = ax + b mod 26 Shift","description":"Apply the Affine map y=(ax+b) mod 26 to encrypt and decrypt text. A textbook substitution-cipher exercise for crypto labs and CTF — offline.","url":"https://tool.warmday.wang/en/crypto/affine","applicationCategory":"SecurityApplication","operatingSystem":"Web","inLanguage":"en","isPartOf":{"@id":"https://tool.warmday.wang/en/crypto/affine#webpage"},"offers":{"@type":"Offer","price":"0","priceCurrency":"CNY"}},{"@type":"BreadcrumbList","@id":"https://tool.warmday.wang/en/crypto/affine#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":"Affine Cipher","item":"https://tool.warmday.wang/en/crypto/affine"}]}]}
```

## Sitemap

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