Message Matrix Encoder
Use a 2×2 or 3×3 key matrix. Letters map as A = 0 through Z = 25.
Example Data Table
| Example Message | Key Matrix | Letter Mapping | Encoded Numbers | Encoded Letters |
|---|---|---|---|---|
| MATH | [3 3; 2 5] | M=12, A=0, T=19, H=7 | 10, 24, 0, 21 | KYAV |
| HELP | [3 3; 2 5] | H=7, E=4, L=11, P=15 | 7, 8, 0, 19 | HIAT |
Formula Used
Step 1: Convert each letter into a number using A = 0, B = 1, ..., Z = 25.
Step 2: Group the numbers into column vectors that match the key matrix size.
Step 3: Multiply each vector by the key matrix.
Step 4: Apply modular reduction: Y = K × X (mod m).
Step 5: Convert results back to letters when the modulus equals 26.
2 × 2 example: If K = [[a, b], [c, d]] and X = [x, y]^T, then Y = [(ax + by) mod m, (cx + dy) mod m]^T.
How to Use This Calculator
- Enter the message you want to encode.
- Select a 2 × 2 or 3 × 3 matrix size.
- Enter the modulus. Use 26 for alphabet encoding.
- Choose a filler letter for incomplete final blocks.
- Type your key matrix values into the matrix fields.
- Click Encode Message to generate the result.
- Review the block table, summary cards, and graph.
- Download the results as CSV or PDF if needed.
Frequently Asked Questions
1. What does this calculator do?
It converts letters into numbers, arranges them in message blocks, multiplies them by a key matrix, and reduces the output with modular arithmetic to create an encoded result.
2. Why are non-letter characters removed?
Matrix message encoding usually relies on a fixed alphabet. Removing spaces, punctuation, and symbols keeps each input character inside the same numeric system.
3. Why is modulus 26 important?
A 26-value modulus matches the English alphabet from A through Z. That allows encoded numbers to convert cleanly back into letters after matrix multiplication.
4. What is a filler letter?
A filler letter pads the final message block when the message length does not exactly fit the chosen matrix size. X is a common filler choice.
5. Does the matrix need to be invertible?
For encoding only, any matrix can produce output. For reversible decoding in modular arithmetic, the determinant should be relatively prime to the modulus.
6. Can I use a 3 × 3 matrix?
Yes. Choose the 3 × 3 option, enter nine values, and the calculator will group message numbers into three-value blocks before encoding them.
7. What does the graph show?
The graph plots encoded numeric values in sequence. It helps you inspect patterns, compare block outputs, and review how values changed after transformation.
8. What can I export?
You can download a CSV version of the calculation table and a PDF summary that includes the cleaned message, encoded output, numeric string, and block-by-block results.