The Playfair cipher is a classical encryption method that works with pairs of letters instead of single characters. These pairs are called digraphs.
First, a letter matrix is generated from the keyword. Duplicate letters are removed from the keyword, and the remaining cells are filled with the rest of the alphabet. In traditional English Playfair, I and J are usually combined to fit the alphabet into a 5×5 matrix.
During encryption, the plaintext is split into digraphs. If two letters are in the same row, they are replaced with the letters to their right. If they are in the same column, the letters below them are used. Otherwise, the rectangle rule applies: each letter is replaced by the character in the same row but from the opposite corner of the rectangle.
Filler letters may be inserted automatically to separate repeated letters or complete a final incomplete pair.