Hill Cipher

Encrypt letter blocks with square key matrices and modular arithmetic.

Input

Output

Using This Tool: Guide & Notes Show guide

The Hill cipher encrypts letter blocks by multiplying plaintext vectors by a key matrix modulo 26.

How to use it

  • Choose the matrix size, then enter or adjust the key matrix values.
  • Check that the matrix is valid before relying on decryption.
  • Paste plaintext or ciphertext into the input box.
  • Use the output and matrix status to confirm how blocks are being processed.

Options and settings

  • Matrix size controls how many letters are processed together in each block.
  • Key values define the matrix. The determinant must allow an inverse modulo 26.
  • Padding fills incomplete final blocks so the matrix operation can run cleanly.
  • Grouping formats the output for readability but does not change the mathematics.

Notes

  • A non-invertible key matrix may encrypt but cannot decrypt reliably.
  • Hill is useful for seeing linear algebra inside classical cryptography.
Related Article

Hill Cipher: The Day Classical Cryptography Became Mathematical

How Lester S. Hill's 1929 matrix cipher moved secret writing beyond alphabet tricks and toward the logic of modern cryptography.

Read the article
Signal acquired

A note from the team

We build these tools because we love cryptography, encoding, and making difficult ideas easier to explore. If they've helped you, even a small coffee means the world to the project. Thank you!

Say thanks on Ko-fi