Matrix Calculator
Calculate matrix products, determinants and inverses with exact fractions and CSV or JSON exports.
This tool processes its input contents in your browser instead of sending them to a processing service. Page, asset and fixed usage-measurement requests are described on the Privacy page.
Calculate six bounded matrix operations with exact reduced fractions, local exports and checkable method steps.
How to use it
- 1Choose addition, subtraction, multiplication, transpose, determinant or inverse.
- 2Paste 1–6 rows, separating entries with commas, spaces or tabs.
- 3Calculate and review exact fraction results; optionally open the working.
- 4Download matrix CSV (import as Text) or exact calculation JSON.
Example
- Input
- Inverse of [[1,2],[3,4]]
- Output
- [[-2,1],[3/2,-1/2]] exactly.
Only square, nonsingular matrices have an ordinary inverse.
What happens to your data
Matrix entries and working stay in this browser tab. Local CSV and JSON retain the calculation; anonymous workflow labels exclude all entries. Spreadsheet CSV should be imported as Text to preserve fractions.
Last updated November 2026
Paste a matrix and choose addition, subtraction, multiplication, transpose, determinant or inverse. Integer, decimal and fraction entries are converted to exact reduced rational values, so a result such as 1/3 stays 1/3 rather than a rounded decimal. The six operations share one simple workspace; a second matrix appears only when the selected operation needs it.
Keep the result as a matrix-shaped CSV, or download JSON with the normalized inputs, each result's numerator and denominator, and a calculation-method record. Optional working explains dot products or row operations without delaying the primary calculation. All arithmetic runs in this browser tab.
How it works
Every entry is stored as a BigInt numerator and a positive BigInt denominator, reduced by their greatest common divisor. For example, 0.1 becomes exactly 1/10, and 2/6 becomes 1/3. Arithmetic reduces fractions throughout the calculation. This avoids floating-point pivot tolerances and preserves exact zero tests, but it does not support symbolic expressions, variables, complex numbers, exponents or arbitrary-size matrices.
Addition and subtraction combine corresponding entries and require identical dimensions. Multiplication A × B requires the number of columns in A to equal the number of rows in B; every result entry is a row-by-column dot product. Transpose swaps rows and columns. Determinant and inverse require a square matrix. Determinants use exact Gaussian elimination, tracking row swaps and pivot products. Inversion applies Gauss–Jordan row operations to [A | I]; if the left side becomes I, the right side is A⁻¹. A missing nonzero pivot proves singularity for the supplied exact rational matrix, so the tool reports that an inverse does not exist. It never invents an inverse using an epsilon threshold.
Enter one matrix row per line. Commas, spaces and tabs separate entries; all rows must have the same number of entries. Thus 1,234 means two entries, 1 and 234, not a grouped thousands value. Empty comma fields, internal blank rows and ragged rows are rejected. Leading and trailing whitespace is ignored. Integers and decimals may have an ordinary + or - sign, up to 12 digits before and 12 digits after a decimal point. A fraction has a signed integer numerator and denominator, each up to 12 digits; zero denominators are rejected and a negative denominator is normalized. Scientific notation, percent signs, formulas, Unicode minus signs and evaluated expressions are not accepted.
Each matrix is bounded to 1–6 rows, 1–6 columns and 16 KiB of text. Every reduced intermediate numerator and denominator is bounded to 4,096 binary digits; a calculation exceeding that budget stops with a size message instead of attempting unbounded computation. The synchronous bounded operation has no background upload or hidden job. Changing inputs or operation, Clear, or Reset example removes previous results and downloads immediately. The initial 2 × 2 example and reset example are labelled and excluded from workflow measurement until the user edits the inputs.
CSV preserves the rectangular result with exact reduced entries. Spreadsheet software can interpret 1/2 as a date, so import every CSV column as Text. No spreadsheet formula is inserted to force a display format. JSON preserves exact strings, explicit numerator/denominator strings, normalized input matrices and the method steps, making it a safer format when exact fraction types matter. Determinants are exported as a 1 × 1 matrix. Downloaded files contain the retained calculation, so review them before sharing. No entry is stored in a URL or sent to analytics. Anonymous workflow measurement records fixed task and outcome labels, never matrix values.
Worked example: An exact inverse with fractions
- Input
- Inverse of A, with rows 1, 2 and 3, 4
- Result
- Rows −2, 1 and 3/2, −1/2. Multiplying A by this result gives the identity matrix exactly.
The determinant is −2. A singular matrix instead receives a clear no-inverse message.
Common use cases
- Multiply rectangular matrices and keep a checkable row-by-column result.
- Compute an inverse without rounding decimal inputs before elimination.
- Find an exact determinant, including row swaps and singular matrices.
- Export reduced fractions for teaching notes, calculations or another application.
Frequently asked questions
Does 0.1 stay exact?+
Yes. An accepted decimal is converted into its exact decimal fraction before calculation: 0.1 is 1/10. The calculator uses BigInt rational arithmetic and displays reduced fractions, not rounded binary64 decimal results.
Why is my matrix not invertible?+
An inverse requires a square matrix with nonzero determinant. If exact elimination cannot find a required nonzero pivot, the matrix is singular and no inverse exists. A non-square matrix does not have an ordinary two-sided inverse.
How should I enter rows and fractions?+
Use one row per line and separate entries with commas, spaces or tabs. For example, 1/2, 0.25 on the first line and 3, -2 on the second. Do not use commas as thousands separators.
Why might a fraction become a date in a spreadsheet?+
Spreadsheet import can auto-detect 1/2 as a date. Import all CSV columns as Text, or use JSON, which retains exact fraction and numerator/denominator strings. The tool does not add spreadsheet formulas.
Can this handle very large matrices or symbolic algebra?+
No. It supports rational entries and matrices up to 6 × 6, with a 4,096-bit intermediate budget. Variables, complex entries, exponents, equation expressions and symbolic simplification are outside this tool's scope.
Standards and limitations
Related tools
Fraction Calculator
Add, subtract, multiply, divide or simplify fractions and mixed numbers with exact steps.
Linear Regression Calculator
Fit paired data or CSV columns, inspect residuals and estimate values with clear local exports.
LCM & GCF Calculator
Find exact LCM and GCF/HCF/GCD answers with prime-factor and Euclidean steps you can verify.
Scientific Notation Converter
Convert exact decimals to scientific, engineering and plain notation with explicit rounding options.