Hill Cipher
Encode and decode with a matrix key of size two or three, with the determinant, modular inverse and inverse matrix shown.
Hill cipher encoder and decoder
Result: —
—
How to use the Hill Cipher
- Choose the matrix size and type the key numbers row by row.
- Pick encode or decode, then paste the text you want to convert.
- Read the determinant and inverse matrix, and copy the result.
Features
- Two by two and three by three matrix keys
- Checks that the matrix is invertible modulo 26
- Shows the determinant, modular inverse and inverse matrix
- Block by block working for the first four blocks
Advertisement
Frequently Asked Questions
Common questions about the free online hill cipher.
It is a polygraphic cipher that turns blocks of letters into numbers and multiplies them by a
key matrix modulo 26.
Decoding multiplies by the inverse matrix, so a matrix with no inverse modulo 26 cannot be
decoded at all.
The determinant reduced modulo 26 must share no common factor with 26 other than the number
one.
Two by two and three by three matrices, because larger sizes need much more text in every
block.
They are removed before the conversion, because the cipher works on letters and pads text to
a full block.
The default is X. Any letter can be chosen, and it is repeated until the letter count fits
the block size.
It breaks easily with a known plaintext attack and a little linear algebra, so it is used for
puzzles only.
No. The matrix and the text stay in your browser and are never uploaded or stored anywhere.
Last updated: October 10, 2026