Hill Cipher Encoder/Decoder

Enter text and a 2×2 key matrix to encode or decode with the Hill cipher.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

Invented by Lester Hill in 1929, the Hill cipher is a classical polygraphic substitution cipher that encrypts letters in blocks rather than one at a time using linear algebra: each pair of letters is mapped to a 2×1 number vector (A=0…Z=25), multiplied by a 2×2 key matrix, and reduced modulo 26 to produce the ciphertext pair. Decryption reverses the process using the key matrix's modular inverse, which only exists if the matrix's determinant is coprime with 26.

This tool encrypts or decrypts text with a Hill cipher given a 2×2 key matrix, handling the modular arithmetic and matrix inversion automatically. Cryptography students and computer science instructors use it to see how matrix multiplication produces diffusion across letter pairs, and to check by-hand homework against a working reference implementation.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators