Free online tools

Matrix Multiplication Calculator

Enter the rows of matrix A and matrix B, then calculate A × B. The number of columns in A must equal the number of rows in B.

Enter your values

Enter one row per line, with commas or spaces between entries. Use decimal points and leave out thousands separators.

This tool processes your input in your browser.

Result

Compare the inner dimensions

A 2 × 3 matrix can multiply a 3 × 2 matrix because its three columns match the other matrix’s three rows. The result is 2 × 2. Each output has the row count of A and the column count of B.

Multiply a row by a column

For the upper-left cell of the example, take row [1, 2, 3] from A and column [7, 9, 11] from B. Multiply corresponding entries and add them to get 1 × 7 + 2 × 9 + 3 × 11 = 58. Repeat with the right column to get 64, then with the second row to get 139 and 154.

Preserve the order of the factors

Matrix products are ordered. In the example, reversing the inputs produces a 3 × 3 result instead. When using a product in a sequence of linear transformations, keep the order specified by the model you are using.

Frequently asked questions

Can the matrices be rectangular?

Yes. Each matrix can have between one and eight rows and columns, provided the inner dimensions match. All rows within one matrix need the same length.

Does the tool round decimal entries?

It treats entered finite decimals as exact and uses integer arithmetic with a decimal scale. It accepts scientific notation with an exponent from −40 to 40, with up to 32 digits in the coefficient.

Is this the same as multiplying matching cells?

An output cell is the sum of products from an entire row and an entire column. Multiplying matching cells is a different operation called element-wise multiplication.