About this tool
Add, multiply and invert matrices up to 6×6 with exact fractions; find the determinant, rank, trace, powers and RREF with Gauss-Jordan steps.
This matrix calculator works on matrices up to 6×6 using exact rational arithmetic: every entry is stored as a whole-number numerator and denominator (JavaScript BigInt), so an inverse comes out as 3/5 and −7/10 rather than 0.6 and −0.70000001. Enter A and B in the editable grids — integers, decimals or fractions — then pick an operation. Determinants are found by row reduction to triangular form, while the inverse, rank and reduced row echelon form use Gauss–Jordan elimination, and each row operation is listed with the matrix after it. Switch between fraction and decimal display, copy results as plain text, LaTeX or an array, and feed a result back in as A or B. Everything runs in your browser.
Open Matrix Calculator on AltFTool — it loads instantly in your browser.
Set the size of matrix A (and B) with the rows and cols menus — anything from 1×1 to 6×6.
Type entries such as 3, -1.5 or 2/3 into the grid, or paste rows copied from a spreadsheet into any cell.
Choose an operation: A + B, A × B, det(A), A⁻¹, RREF(A), rank(A), Aᵀ, tr(A), Aⁿ with Power n, or k·A with Scalar k.
Toggle Fractions or Decimals, expand the steps of working, and copy the answer as Text, LaTeX or Array.
Fraction arithmetic means a 6×6 Hilbert matrix determinant comes out as exactly 1/186313420339200000 — and a decimal view with 2 to 10 places is one click away.
Determinant, inverse, rank and RREF list every swap, scaling and elimination, such as R2 → R2 + (3/2)·R1, with the matrix after each step.
Arrow keys and Enter move between cells, a block pasted from a spreadsheet fills the grid, and Random, Identity and Zero presets set it up in one click.
Results copy as tab-separated text, a LaTeX bmatrix or a nested array, and your matrices are saved in this browser for next time.
| Operation | Requirement | Result |
|---|---|---|
| A + B, A − B | B is also m×n | m×n matrix |
| A × B | B is n×p (columns of A = rows of B) | m×p matrix |
| k·A | any scalar k | m×n matrix |
| Aᵀ (transpose) | none | n×m matrix |
| det(A) | square (m = n) | single number |
| A⁻¹ (inverse) | square and det(A) ≠ 0 | n×n matrix |
| Aⁿ (power) | square; negative n needs det(A) ≠ 0 | n×n matrix |
| tr(A) (trace) | square | single number |
| rank(A), RREF(A) | none | number / m×n matrix |
Matrix multiplication is not commutative: A × B and B × A are usually different, and one may exist when the other does not.
Each entry of A × B is the dot product of a row of A with a column of B: multiply matching entries and add them. This only works when A has as many columns as B has rows, and an m×n matrix times an n×p matrix gives an m×p result. Order matters, so A × B and B × A are generally different.
For a 2×2 matrix [[a, b], [c, d]] the determinant is ad − bc. For larger matrices you can use cofactor expansion, but row reduction is faster: reduce to upper-triangular form, multiply the diagonal entries, and flip the sign once for every row swap. Adding a multiple of one row to another does not change the determinant.
Write the matrix next to the identity, [A | I], and apply Gauss–Jordan row operations until the left side becomes I; the right side is then A⁻¹. For a 2×2 matrix [[a, b], [c, d]] the shortcut is 1/(ad − bc) × [[d, −b], [−c, a]]. You can check the answer because A × A⁻¹ = I.
A square matrix has no inverse when its determinant is 0. Such a matrix is called singular: its rows (and columns) are linearly dependent, its rank is less than its size, and its row-reduced form has at least one row of zeros. Non-square matrices never have a two-sided inverse.
A matrix is in RREF when every non-zero row starts with a leading 1, each leading 1 is to the right of the one above it, every other entry in a leading 1's column is 0, and any zero rows are at the bottom. Every matrix has exactly one RREF, which makes it the standard way to solve linear systems and find rank.
The rank is the number of linearly independent rows, which equals the number of linearly independent columns. In practice you row-reduce the matrix and count the non-zero rows, or equivalently the pivot columns. A square n×n matrix is invertible exactly when its rank is n.
Put the coefficients and the constants into A as an augmented matrix — for three equations in three unknowns that is a 3×4 matrix — and choose RREF(A). If the left 3×3 block becomes the identity, the last column is the solution. Alternatively, invert the coefficient matrix and multiply by the constants column.
The transpose Aᵀ swaps rows and columns, so the entry in row i, column j moves to row j, column i, and an m×n matrix becomes n×m. Useful facts are (Aᵀ)ᵀ = A, (A × B)ᵀ = Bᵀ × Aᵀ and det(Aᵀ) = det(A).
Yes. Cells accept integers, decimals like −1.25, fractions like 3/4 and mixed numbers like 2 1/2. Decimals are converted to exact fractions (0.1 becomes 1/10), so results carry no floating-point error. Use the Fractions or Decimals toggle to choose how answers are displayed.
The trace is the sum of the entries on the main diagonal of a square matrix, from top-left to bottom-right. It equals the sum of the eigenvalues, and it satisfies tr(A + B) = tr(A) + tr(B) and tr(A × B) = tr(B × A) even when A × B ≠ B × A.
Add the Matrix Calculator widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.
<iframe src="https://www.altftool.com/embed/widget/matrix-calculator"
title="Matrix Calculator — free AltFTool widget"
width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/matrix-calculator?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>