Matrix rank calculator
Enter rows 1, 2, 3; 4, 5, 6; 7, 8, 9 and get rank 2: elimination leaves only two pivots, so the matrix is not full rank. The row echelon form and each step are shown. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
A matrix rank calculator answers a basic linear-algebra question: how many independent rows (or columns) does a real matrix really have? Enter the matrix as nested numeric rows or as plain text with commas and line breaks; the tool reduces a working copy to row echelon form with partial pivoting, treats near-zero entries as zeros under a fixed epsilon, and returns the integer rank as the number of pivots together with the pivot column indices, a rounded original matrix, the row-echelon form, and ordered elimination steps. Homework checks, exam prep, control and data-science pipelines that need a quick full-rank test, and coding kata expected values all need that same pivot count without spinning up a computer-algebra system.
What matrix rank means and how row echelon form finds it
The rank of a real matrix is the dimension of its column space, which equals the dimension of its row space and also equals the number of nonzero rows after Gaussian elimination to row echelon form. In that form each leading nonzero entry—a pivot—sits strictly to the right of the pivot in the row above, and every entry below a pivot is zero.
Counting those pivots is therefore counting independent directions: a full-rank square matrix has as many pivots as rows (and columns), a rank-deficient matrix has fewer, and the zero matrix has rank zero. Entries whose absolute value falls at or below a fixed epsilon after elimination are treated as exact zeros so floating cancellation does not invent phantom pivots.
Teachers and automated graders care about the inconsistent-row-length rejection as much as the rank value: a student who pastes a jagged array has not stated a matrix, and a silent reshape would hide that mistake. The published steps restate each swap and elimination so you can assert the algorithm path in tests or worksheets without re-deriving the arithmetic by hand.
Practical tips, limits, and related searches
Keep every entry inside the published absolute range and prefer sending nested number arrays when you control the client; text form is convenient for paste-from-spreadsheet workflows but still parses under the same numeric rules. Near-zero pivots after floating cancellation are dropped by the epsilon test so noise does not inflate rank on nearly dependent rows. Prefer this capability when you already have numeric entries and only need the pivot rank; if your source is a word problem, assemble the coefficient matrix first.
Round-trip checks are easy: re-run elimination by hand on a small matrix and confirm the published rank and pivot columns match, and confirm that zeroing one independent row drops rank by one while leaving dimensions unchanged.
What you can do with it
Homework checks for Gaussian elimination
Students paste textbook matrices and compare hand-written rank, pivot columns, and row-echelon shape against a deterministic result before submitting.
Pre-flight full-rank tests in data pipelines
Pipelines assert that a design or feature matrix is full rank before solving least squares or inverting a square block, failing fast on rank-deficient input.
FAQ
How is matrix rank computed here?
The tool reduces a working copy of the matrix to row echelon form with partial pivoting and counts the number of pivots. That count is the rank.
Does full rank mean the matrix is invertible?
For a square n×n matrix, rank n is equivalent to invertibility over the reals. For a non-square matrix, full rank means rank equals min(rows, cols), not that a two-sided inverse exists.
Does this return eigenvalues or SVD?
No. It returns rank, pivot columns, the rounded original, row echelon form, and elimination steps. Use a dedicated eigensolver or SVD tool if you need those factorizations.
Is the matrix rank calculator free?
The browser tool is free and runs locally.
Why does the matrix with rows 1, 2, 3; 4, 5, 6; 7, 8, 9 have rank 2?
Because its rows are not independent. After elimination the last row becomes all zeros, so only two pivots remain, and the rank is the number of pivots: 2 instead of 3.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/algebra/matrix-rank \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"matrix":[[1,2,3],[4,5,6],[7,8,9]]}'const res = await fetch("https://api.kit.forhosting.com/algebra/matrix-rank", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"matrix": [
[
1,
2,
3
],
[
4,
5,
6
],
[
7,
8,
9
]
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/matrix-rank",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"matrix": [
[
1,
2,
3
],
[
4,
5,
6
],
[
7,
8,
9
]
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/matrix-rank", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"matrix":[[1,2,3],[4,5,6],[7,8,9]]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"matrix":[[1,2,3],[4,5,6],[7,8,9]]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/matrix-rank", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"matrix": [
[
1,
2,
3
],
[
4,
5,
6
],
[
7,
8,
9
]
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.matrix_rank",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_rows | 32 |
max_cols | 32 |
max_abs | 1000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
If two rows have different lengths the API rejects the request with invalid_input instead of silently padding or truncating.
What matrix rank means and how row echelon form finds it
Partial pivoting swaps the current row with the row below that holds the largest absolute entry in the active column so that division factors stay as well-conditioned as a pure elementary-row algorithm can manage in IEEE doubles.
How to call the API and what comes back
Accept either an array of equal-length numeric rows—for example three rows of three numbers each—or a text block where rows are separated by newlines or semicolons and entries by commas or spaces. Send a JSON body with one required field matrix (aliases rows, A, and data). Every entry must be a finite number whose absolute value stays within the published limit of one trillion, and the whole matrix may have at most thirty-two rows and thirty-two columns so Worker and browser work stays interactive. On success the response sets rank to the integer pivot count, rows and cols to the dimensions, pivots to the zero-based column indices of each pivot in order from top to bottom, full_rank to whether rank equals min(rows, cols), matrix to the rounded original, row_echelon to the rounded reduced form, message to a short English summary, and steps to an ordered array of elimination notes. Failed validation—missing matrix, empty rows, non-finite or out-of-range entries, dimensions above the limits, or inconsistent row lengths—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.
Practical tips, limits, and related searches
When teaching, pair examples: the classic three-by-three of consecutive integers has rank two because the third row is a linear combination of the first two; the two-by-two identity has rank two and full_rank true; a single zero row has rank zero; and a jagged pair such as one row of two entries and one row of three demonstrates the hard invalid_input path for inconsistent row lengths. This landing targets people searching for a matrix rank calculator, row echelon form pivots, or linear algebra rank online; it is not a singular-value decomposition tool, not a determinant-only checker (though for square matrices rank equals n if and only if the determinant is nonzero), and not a symbolic computer-algebra system. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately send jagged rows.
Integration use cases
Unit tests for student linear-algebra code
Generate known-good full-rank, rank-deficient, and zero matrices plus deliberate jagged-row rejections for coding kata expected values.
Technical questions
What happens if rows have different lengths?
The input is not a rectangular matrix. This tool returns invalid_input naming the inconsistent row lengths instead of padding or truncating.