Hill Cipher
Encrypt and decrypt with the Hill cipher, a polygraphic substitution cipher based on linear algebra. It uses a square matrix as the key to encrypt blocks of letters simultaneously, making it more resistant to frequency analysis than simple substitution ciphers. The process involves matrix multiplication modulo 26. For decryption, the key matrix must be invertible modulo 26 (its determinant must be coprime to 26). Everything runs locally in your browser.
Encrypt (plaintext → cipher)
Decrypt (cipher → plaintext)
The math. The Hill cipher treats text as vectors in $\\mathbb{Z}_{26}$. For a matrix size $n$, the plaintext is split into blocks of $n$ letters. Encryption is $C = (K \\cdot P) \\pmod{26}$, where $K$ is the key matrix and $P$ is the plaintext vector. Decryption is $P = (K^{-1} \\cdot C) \\pmod{26)$. The modular inverse $K^{-1}$ exists only if $\\gcd(\\det(K), 26) = 1$. Since 26 has prime factors 2 and 13, the determinant must not be divisible by 2 or 13. Pairs with the Caesar, Vigenère, and Playfair cipher tools. Everything runs locally — nothing leaves your browser.