Matrix Multiplication & Transpose Calculator

The basic building block of a neural network's forward pass. Multiply matrices, transpose them and add a bias, then see exactly how every result cell is calculated.

Results update as you type. Everything runs in your browser.

  1. 1. Pick a starting point

    Click a preset, for example Forward pass, so both matrices are already filled in.

  2. 2. Set the sizes

    Choose rows × columns for A and B. Existing numbers are kept when you resize.

  3. 3. Enter your numbers

    Type into any cell. Decimals and negatives are fine.

  4. 4. Choose transposes

    Tick Transpose A or Transpose B to flip that matrix before multiplying.

  5. 5. Read the result

    Click any result cell to see the exact multiplication that produced it.

Matrices — edit sizes and values

Matrix A rows × columns
Matrix B rows × columns
Bias b — one value per result column (4), added to every row

Result Z = A × Bᵀ + b — 2×4

Shape
2×3 · 3×4 → 2×4
MACs
24
FLOPs (2 × MACs)
48
Dot-product length
3

Step by step — cell (1, 1); click any result cell to change it

Row 1 of A · column 1 of Bᵀ

(1 × 0.5) + (0 × -1) + (2 × 0.2) + b1 (0.1)
= 1

Transposes

Aᵀ — 3×2
1
3
0
1
2
0
Bᵀ — 3×4
0.5
1
0
0.3
-1
0
2
0.3
0.2
1
-1
0.3

Entry (i, j) of a matrix becomes entry (j, i) of its transpose.

The plain-English guide

A neural network layer is mostly one matrix multiplication: Z = X·Wᵀ + b. X holds your inputs, W holds the learned weights, and b shifts the outputs. Load the Forward pass preset to see it.

Key words, explained simply

Matrix

A grid of numbers with m rows and n columns, written m×n.

Transpose (Aᵀ)

Flip rows and columns: entry (i, j) moves to (j, i). An m×n matrix becomes n×m.

Matrix multiplication

Each result cell is the dot product of a row of A and a column of B.

Dimension rule

A×B only works when the columns of A equal the rows of B. Result is (rows of A) × (columns of B).

Bias (b)

A vector added to every row of the result. In a neural network layer it shifts each output.

Forward pass

One layer computes Z = X·Wᵀ + b: X is the batch of inputs, W the weights, b the bias.

MACs / FLOPs

A multiply-add is 1 MAC = 2 FLOPs. Multiplying m×n by n×q costs m·n·q MACs.

How this calculator works

Each result cell is C[i][j] = Σₖ A[i][k] × B[k][j], plus b[j] when a bias is on. Transposes are applied first, so Aᵀ × B means "flip A, then multiply". Cost is m·n·q multiply-adds for an m×n by n×q product.

Common questions