Audited 29 Jul 2026·Last updated 31 Jul 2026·4 citations·Tier 2·0 uses

Matrix Rank Calculator

Find the rank of any matrix up to 10x10, square or rectangular. Get the rank, the nullity from the rank-nullity theorem, and which columns hold pivots.

Matrix Rank Calculator

One row per line. Separate entries with commas or spaces.
Rank of A
2
The number of linearly independent rows, which is always equal to the number of linearly independent columns.
Rows (m)
3
Columns (n)
4
Nullity (n − rank)
2
Full rank or rank deficient
Rank deficient — the rank 2 is below min(rows, columns) = 3, so 1 row is a linear combination of the others.
Pivot columns
1, 2

Background.

The rank of a matrix is the number of genuinely independent rows it has — how much real information is in it, once you strip out every row that is just a combination of the others. This calculator takes any real matrix up to 10 by 10, square or rectangular, and returns its rank, its nullity, and exactly which columns held a pivot during elimination.

Type or paste your matrix with one row per line. Entries can be separated by commas or spaces, rows by line breaks or semicolons, and the bracketed form [[1,2],[3,4]] is accepted too. Unlike a determinant, rank is defined for any shape, so a 3 by 5 matrix is perfectly fine here.

The rank answers three questions at once, and they turn out to be the same question. It is the number of linearly independent rows. It is also the number of linearly independent columns — a genuinely surprising theorem, since there is no obvious reason those two counts should match. And it is the largest size of a square submatrix whose determinant is not zero. The Encyclopedia of Mathematics gives all three characterisations, and this calculator computes the first while the worked example checks it against the third.

The companion number is the nullity: the dimension of the null space, meaning how many independent solutions the equation Ax = 0 has beyond the trivial all-zeros one. The rank-nullity theorem ties them together with a single line — rank plus nullity equals the number of columns — which is why a rank-deficient system has infinitely many solutions rather than exactly one. In the language of elimination, the rank counts the pivot variables and the nullity counts the free variables.

The verdict beside the answer uses LAPACK's vocabulary. Full rank means the rank has hit min(rows, columns), the largest value it could possibly take for a matrix of that shape. For a square matrix, full rank is exactly the same statement as non-singular: the determinant is not zero, the inverse exists, and Ax = b has one unique solution. For a rectangular matrix, full rank still means the most independence the shape allows, but the consequences differ — a tall full-rank matrix gives a least-squares problem a unique answer, while a wide one gives Ax = b infinitely many solutions.

One limit belongs right next to the number rather than buried in an FAQ. Deciding rank means deciding when a pivot is zero, and for numbers with decimals that is a judgement call rather than a fact. This calculator treats a pivot candidate as zero when its absolute value is at or below 1e-10 times the largest absolute entry of the matrix you entered. The test is relative, so multiplying your whole matrix by a million cannot change the answer. For an integer matrix the threshold never comes into play at all, because the arithmetic runs at 60 significant digits and a genuine zero comes out as an exact zero. But if your data is measured rather than exact, be aware that the rank of a near-dependent matrix is a modelling decision, not an observation — professional numerical software makes the same decision using the singular values instead of the pivots, and can disagree at the margin.

What this page deliberately does not print is the row-echelon form itself, even though it computes one on the way. That is the deliverable of a separate calculator, and duplicating it here would add nothing for someone who came asking about rank.

What is matrix rank calculator?

The rank of an m x n matrix A is the dimension of the space spanned by its rows, which is always equal to the dimension of the space spanned by its columns. Equivalently, it is the largest k for which A has a k x k submatrix with a non-zero determinant — the maximal order of a non-zero minor. Rank is bounded above by min(m, n): a matrix that attains that bound has full rank, and one that does not is rank deficient. The nullity is the dimension of the null space N(A) = {x : Ax = 0}, and the rank-nullity theorem states that rank + nullity = n, the number of columns. In elimination terms, reducing A to row-echelon form produces one pivot per independent row; the number of pivots is the rank, the columns holding those pivots are the pivot columns (and form a basis for the column space), and every other column corresponds to a free variable in Ax = 0. Rank is unchanged by any elementary row or column operation, by transposition, and by multiplication by an invertible matrix — which is why elimination is a valid way to compute it.

How to use this calculator.

  1. Type your matrix into the box, one row per line, with entries separated by commas or spaces. The matrix does not need to be square.
  2. You can also paste [[1,2,3],[4,5,6]] or use semicolons as row separators — both are parsed.
  3. Read the headline number: that is the rank, the count of linearly independent rows.
  4. Read the nullity to know how many free variables Ax = 0 has. Rank plus nullity always equals the number of columns.
  5. Check the full rank / rank deficient verdict. For a square matrix, full rank and non-singular mean the same thing.
  6. Read the pivot column list to see which columns carried the independence — those columns form a basis for the column space of A.
  7. If your entries are measured rather than exact, remember the zero threshold: a pivot at or below 1e-10 times your largest entry is counted as zero.

The formula.

rank(A) = number of pivots in row echelon form ; rank + nullity = n

Rank is computed by Gaussian elimination with partial pivoting, walking the columns from left to right while advancing the pivot row only when a pivot is actually found — which is what lets the same loop handle rectangular and rank-deficient matrices without a special case. For each column, the algorithm looks at every row at or below the current pivot row, picks the entry with the largest absolute value, and if that value is above the zero threshold it swaps that row up, eliminates the column from every row below it, records the column as a pivot column, and moves the pivot row down one. If the largest candidate is at or below the threshold, the whole column is treated as zero below the pivot row, so it becomes a free column and the pivot row is not consumed. The rank is the number of pivot columns recorded; the nullity is the number of columns minus the rank, which is the rank-nullity theorem read straight off the algorithm. On the worked example A = [[1,2,3,4],[2,4,6,8],[1,3,5,7]], pivoting swaps the row starting with 2 to the top, subtracting half of it from each remaining row zeroes the first column and turns the old first row into [0,0,0,0] because it was exactly half of the row above; the third row becomes [0,1,2,3], which supplies the second pivot; and nothing is left for columns 3 and 4. Two pivots, in columns 1 and 2, so rank = 2, and nullity = 4 - 2 = 2. All arithmetic runs at 60 significant digits with no intermediate rounding, and the zero threshold is 1e-10 times the largest absolute entry of the matrix as entered, making the test relative rather than absolute.

A worked example.

Example

Take the 3 by 4 matrix A = [[1,2,3,4],[2,4,6,8],[1,3,5,7]]. The second row is exactly twice the first, so it carries no information the first row did not already carry — at most two of the three rows can be independent. Elimination confirms it: partial pivoting moves the row beginning with 2 to the top, subtracting half of it from the old first row leaves [0,0,0,0], and subtracting half of it from the third row leaves [0,1,2,3], which supplies a second pivot in column 2. Columns 3 and 4 have nothing left below, so the process stops with two pivots, in columns 1 and 2. The rank output is therefore 2, and the pivot columns output reads 1, 2. Because min(rows, columns) = min(3, 4) = 3 and the rank is only 2, the verdict is rank deficient, with 1 row that is a linear combination of the others. The nullity is columns minus rank = 4 - 2 = 2, meaning Ax = 0 has a two-dimensional space of solutions and the system has two free variables. As an independent check against a different definition of rank entirely — the maximal order of a non-zero minor — every 3 by 3 submatrix of A contains both the first and second rows or their proportional images, so all of them have determinant zero; but the 2 by 2 minor on rows 1 and 3 and columns 1 and 2 is det[[1,2],[1,3]] = 3 - 2 = 1, which is not zero. Maximal order of a non-zero minor = 2, matching the rank the elimination found.

matrix1, 2, 3, 4 2, 4, 6, 8 1, 3, 5, 7

Frequently asked questions.

What does the rank of a matrix actually tell you?
It tells you how many of the rows are genuinely independent — how much non-redundant information the matrix contains. A 5 by 5 matrix of rank 3 has two rows that are just combinations of the other three. For a system of equations that means two of your five equations were not adding any new constraint, so the system either has infinitely many solutions or none at all, but never exactly one. For data, a low rank means your variables are measuring overlapping things.
Is the row rank always equal to the column rank?
Yes, always, for every matrix over a field, and it is one of the more surprising theorems in linear algebra — there is no obvious reason that counting independent rows and counting independent columns should give the same answer, since a matrix can have far more rows than columns. The Encyclopedia of Mathematics states both definitions and notes their equivalence. A practical consequence you can check on this page: entering a matrix and then entering its transpose gives the same rank.
What is the rank-nullity theorem?
Rank plus nullity equals the number of columns. The rank counts the pivot variables in Ax = 0 and the nullity counts the free variables, and every column is one or the other, so the two must add up to n. It is why a wide matrix — more columns than rows — always has a non-trivial null space: the rank cannot exceed the number of rows, so the nullity is at least n minus m, which is positive. That is the algebraic reason an underdetermined system always has infinitely many solutions when it has any at all.
What does full rank mean?
That the rank has reached min(rows, columns), the largest value the shape allows. LAPACK's own documentation uses exactly this split: rank(A) = min(m,n) means A has full rank, and rank(A) < min(m,n) means it is rank deficient. For a square matrix, full rank is the same statement as non-singular — the determinant is non-zero, the inverse exists, and Ax = b has exactly one solution. For a tall matrix, full column rank makes a least-squares fit unique. For a wide one, full row rank means Ax = b is always solvable, just not uniquely.
Can a rectangular matrix have a rank?
Yes, and that is the main reason to reach for rank rather than a determinant. The determinant only exists for square matrices, but rank is defined for any shape and answers the same underlying question about independence. A 2 by 7 matrix can have rank 0, 1 or 2 — never more, because rank cannot exceed the number of rows. If you tried to enter a rectangular matrix into the determinant calculator it would refuse; this page is the one that handles it.
How do you find rank by hand?
Row-reduce the matrix to echelon form and count the non-zero rows — each one contributes a pivot, and the number of pivots is the rank. You do not need the fully reduced form; ordinary forward elimination is enough. The alternative textbook method is to hunt for the largest square submatrix with a non-zero determinant, since the rank equals the maximal order of a non-zero minor, but that is far more work for anything beyond 3 by 3 because the number of submatrices explodes.
Why does the answer depend on a zero tolerance?
Because with decimal entries, deciding whether a pivot is zero is a judgement rather than a fact — an entry of 1e-13 might be a genuine zero corrupted by rounding, or a genuinely tiny value. This calculator declares its rule openly: a pivot at or below 1e-10 times the largest absolute entry of your matrix counts as zero. The test is relative, so scaling your entire matrix changes nothing. For integer matrices the threshold is irrelevant, because the arithmetic runs at 60 significant digits and an exact zero stays exactly zero. Numerical libraries make the same decision from the singular values instead, and can differ from this page for a genuinely borderline matrix.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 977 calculators remain free
  • No billing is enabled
Coming soon