Affine Cipher
Affine Cipher encryption and decryption, E(x) = (ax + b) mod 26.
Key Parameters
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 HashGenerate 32-char MD5 digests for text and files to verify integrity and detect content changes locally.Hash CalculatorMD5, SHA-1, SHA-256, SHA-512 digests for text and files in one pass for checksums.Base64 ConverterBase64 encode/decode for text, UTF-8 and images, with Data URL output for inline embedding.Symmetric EncryptionEncrypt/decrypt with AES, DES, 3DES, RC4 and SM4, configurable mode, padding, key and IV, fully client-side.RSA ToolsGenerate RSA key pairs (1024-4096 bit), encrypt/decrypt and sign with PKCS#1 v1.5 or PSS, browser-side.PGP ToolsGenerate OpenPGP keys, encrypt, decrypt and sign text or files with GnuPG-compatible ASCII-armored output.