# Hill Cipher if the length of the string is not divisible by the Key Dimensions

For a project, I want to encode the word "MEMBRANOPHONES" with the key "MULTITONE". I try spliting "MEMBRANOPHONES" into groups of 3, but then I get "MEM", "BRA", "NOP", "HON", leaving me with a 2 letter "ES". I can't multiply a 3 by 3 matrix by a 2 by 1 matrix, so what do I do in this case?

The most common padding is PKCS#7 padding: If one byte is left, append 0x01, if two are left append 0x02 0x02 and so on. Note that this requires you to also pad on messages which are a multiple of the blocksize (in case your message ends on eg 0x01).
As you are more concerned with letters than bytes, you can probably adapt the above scheme to use A instead of 0x01 and B instead of 0x02 and so on for the full alphabet. So in your particular case you would pad the message with a single A.