How Our Math Calculators Work
This page explains the formulas, input rules, and rounding behind our average, mean, median, mode, weighted average, LCM, GCF, standard deviation, and age calculators, and lists the test cases every release must pass.
Definitions
We follow the NIST/SEMATECH e-Handbook of Statistical Methods, sections 1.3.5.1 Measures of Location and 1.3.5.6 Measures of Scale.
| Measure | How we calculate it |
|---|---|
| Mean (average) | Sum of the values ÷ number of values |
| Median | Middle value of the sorted list; with an even count, the average of the two middle values |
| Mode | Every value that appears most often. If all values appear once, there is no mode |
| Range | Largest value − smallest value |
| Sample standard deviation | √(Σ(x − mean)² ÷ (N − 1)); not shown for a single value |
| Population standard deviation | √(Σ(x − mean)² ÷ N) |
| Weighted average | Σ(value × weight) ÷ Σ(weight) |
LCM and GCF
Methods follow OpenStax Prealgebra 2e, 2.5 (least common multiple) and OpenStax Elementary Algebra 2e, 7.1 (greatest common factor).
| Result | How we calculate it |
|---|---|
| GCF | Euclid's algorithm: divide the larger number by the smaller, then the smaller by the remainder, until the remainder is 0; the last nonzero remainder is the GCF. For 3 or more numbers, GCF(a, b, c) = GCF(GCF(a, b), c) |
| LCM | LCM(a, b) = a ÷ GCF(a, b) × b, chained for 3 or more numbers, in exact integer (BigInt) arithmetic so large results aren't rounded |
| Prime factorization | Trial division up to the square root; the GCF takes the lowest power of each shared prime and the LCM the highest power of every prime |
| Listing | Factors are listed when every number is 10,000 or less; multiples when the LCM is at most 50 times the smallest number |
Inputs: 2 to 20 whole numbers from 1 to 1,000,000,000,000. Negative numbers are replaced by their positive values; 0, decimals, and other text aren't accepted.
Factors
The factor calculator uses the definitions in OpenStax Prealgebra 2e, 2.4 and NIST DLMF 27.2:
- Prime factorization by trial division up to the square root (the same routine as the GCF and LCM calculators).
- All factors are built from the prime factorization: every product of the primes, each used from 0 times up to its exponent, sorted. Factor pairs match the smallest factor with the largest, and so on inward.
- Number of factors d(n) = product of (exponent + 1); sum of factors σ(n) = the sum of the list. Perfect, abundant or deficient (standard number theory terms; perfect numbers are listed in OEIS A000396) compares σ(n) − n with n. 1 is neither prime nor composite.
- Two to 20 numbers: the common factors are the factors of their GCF (Euclid's algorithm).
Inputs: whole numbers from 1 to 1,000,000,000,000; negatives use their positive value; 0 and decimals aren't accepted. Lists longer than 240 numbers are shortened, with the full list in a collapsed block; factor pairs aren't listed past 240 pairs. The division ladder divides by the smallest prime factor until 1 is left. Test cases: 24 has 8 factors (2³ × 3), sum 60, abundant; 36 has 9, with the pair 6 × 6; 6, 28 and 496 are perfect; 360 has 24 factors; 720,720 has 240; 1,000,000,000,000 = 2¹² × 5¹² has 169; the common factors of 24 and 36 are 1, 2, 3, 4, 6 and 12.
Volume and Cubic Yards
The volume calculator and cubic yard calculator share one engine:
- Formulas: box L × W × H, cube s³, cylinder π r² h, sphere 4/3 π r³, cone 1/3 π r² h (OpenStax Prealgebra 2e, 9.6); pyramid 1/3 × base area × height (OpenStax Calculus 1, 6.2); triangular prism ½ b h × length; hemisphere half a sphere; tube π (R² − r²) × length. Diameters are halved to radii.
- Units: every result is turned into cubic feet, then converted with 1,728 in³ = 1 ft³, 27 ft³ = 1 yd³ and 1 US gallon = 231 in³ (NIST Handbook 44, Appendix C), and 1 ft = 0.3048 m exactly, 1 L = 1,000 cm³ (NIST).
- Cubic yards: area (rectangle L × W, circle π r², triangle ½ base × height, or a known area) × depth × number of areas, ÷ 27. Extra adds a percentage; bags = volume with extra ÷ cubic feet per bag, rounded up; cost = cubic yards with extra × price.
Displayed values keep up to 3 decimals (2 from 1,000 up, 4 significant digits below 1, scientific notation from 1015). These two calculators accept thousands commas (1,000), a leading $ and a trailing %, and reject comma decimals such as 1,5 with a hint to use a period; values above 1,000,000,000 aren't accepted. Not modelled: material weight (tons), compaction, and supplier minimums. Test cases: 10 × 10 × 10 ft = 1,000 ft³ = 37.037 yd³ = 7,480.52 gal; a 10 cm cube = 1 L; 10 × 10 ft at 3 in = 25 ft³ = 0.9259 yd³; 324 sq ft at 1 in = 1 yd³; 12 × 12 ft at 3 in with 10% extra = 1.467 yd³, 20 bags of 2 cu ft, $58.67 at $40 per yd³.
Slope and Lines
The slope calculator has three modes.
- Two points: m = (y₂ − y₁) ÷ (x₂ − x₁); point-slope y − y₁ = m(x − x₁); slope-intercept y = mx + b with b = y₁ − m·x₁; a horizontal line has slope 0 and a vertical line an undefined slope; perpendicular slope = −1 ÷ m (OpenStax College Algebra 2e, 4.1); standard form Ax + By = C (2.2), shown with whole-number, coprime A, B and C and a positive x term; distance √(Δx² + Δy²) and midpoint ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2) (2.1); angle = arctan(m) and percent grade = 100m.
- Point and slope: the line through (x₁, y₁) with slope m, b = y₁ − m·x₁, with the same equation forms; for a slope and y-intercept, use the point (0, b).
- Exact arithmetic: inputs (whole numbers, decimals up to 9 places, negatives, fractions such as 3/4 or 1 1/2, and thousands commas) are read as fractions, so the slope, intercepts and equations are reduced fractions. More than 9 decimal places, identical points and values beyond ±1,000,000,000 are rejected; the distance step shows the exact root and the rounded value.
- Grade: slope from rise ÷ run, a percent (÷ 100), an angle (tan) or a ratio 1:N (1 ÷ N); outputs slope, percent, angle and 1:N. Ramps: the ADA maximum running slope is 1:12 and a run rises at most 30 inches, (U.S. Access Board guide, Chapter 4), and a walking surface steeper than 1:20 is a ramp (2010 ADA Standards 106.5); the shortest run for a rise is 12 × the rise, and runs needed = rise ÷ 30, rounded up.
- Test cases: (2, 3) and (6, 11) → m = 2, y = 2x − 1, 2x − y = 1, distance √80; (1, 2) and (5, 5) → m = 3/4, y = (3/4)x + 5/4, 3x − 4y = −5; (−1, 4) and (3, −2) → m = −3/2, 3x + 2y = 5; (1, 3) and (7, 3) → slope 0; (4, 1) and (4, 9) → undefined, x = 4; 1:12 = 8.33% = 4.76°; 45° = 100%; a 24-inch rise → 288 inches (24 ft) of run at 1:12; 36 inches → 2 runs.
Pythagorean Theorem
The Pythagorean theorem calculator uses a² + b² = c² for a right triangle with legs a, b and hypotenuse c (OpenStax Prealgebra 2e, 9.3): c = √(a² + b²) and a = √(c² − b²), with the hypotenuse required to be the longest side. With three sides it compares the two smaller squares with the largest exactly; equal means a right triangle by the converse of the theorem (Common Core 8.G.B.6); the two shorter sides must add to more than the longest. Inputs are read as exact fractions (BigInt arithmetic), so missing sides are simplified radicals (√74, 3√3, 10√2) with a decimal; fractional bases are bracketed in the steps, as (5/2)². Squares too large to hold exactly fall back to a decimal answer. In check mode the longest side is treated as the hypotenuse, and near-misses within 0.1% get a rounding note. Extras: angle A = arctan(a ÷ b), B = 90° − A, area = ½ab, perimeter, height to the hypotenuse = ab ÷ c.
Test cases: 3, 4 → 5; 5, 12 → 13; 5, 7 → √74 ≈ 8.6023; 1, 1 → √2; 10, 10 → 10√2; c 13 with a 5 → 12; c 6 with a 3 → 3√3; 5, 12, 13 is right, 6, 7, 9 isn't (85 ≠ 81); 3-4-5 has angles 36.87° and 53.13°, area 6, height 2.4.
Square, Cube and Nth Roots
The square root calculator gives the principal root: √m is the non-negative number whose square is m (OpenStax Elementary Algebra 2e, 9.1). It simplifies by pulling the largest perfect n-th power out of the radicand, using ⁿ√(ab) = ⁿ√a·ⁿ√b (9.2; Intermediate Algebra 2e, 8.2); a fraction p/q uses ⁿ√(p·qⁿ⁻¹) ÷ q. Odd roots of negative numbers are negative real numbers; even roots of negative numbers have no real value (OpenStax Intermediate Algebra 2e, 8.1). Prime factors come from trial division. Inputs up to 1,000,000,000,000; roots 2 to 10. A fraction is a perfect power when its reduced numerator and denominator both are; radicands above 1012 are shown as decimals. Arithmetic is exact (BigInt).
Test cases: √144 = 12; √50 = 5√2 ≈ 7.071068; √72 = 6√2; √0.25 = 1/2; √(9/16) = 3/4; ∛54 = 3∛2; ∛(−8) = −2; ∜32 = 2∜2; the 5th root of 64 = 2 × ⁵√2; √−16 has no real root.
Quadratic Formula
The quadratic formula calculator solves ax² + bx + c = 0 with a ≠ 0 as x = (−b ± √(b² − 4ac)) ÷ 2a, and classifies the discriminant: zero gives one double rational solution, a positive rational square (numerator and denominator both perfect squares, tested exactly at any size) two rational solutions, other positive values two irrational solutions, negative values two complex solutions with i = √−1 (2.4) (OpenStax College Algebra 2e, 2.5). a, b and c are read as exact fractions; roots are written (P ± Q√r) ÷ L in lowest terms when the radicand is small enough to simplify (up to 1012), with i for complex roots, plus decimals; otherwise decimals only. A bare x factor is written first, and factored forms with root denominators over 1,000 are left out. With rational roots r₁ = p₁/q₁ and r₂ = p₂/q₂ the factored form is (a ÷ q₁q₂)(q₁x − p₁)(q₂x − p₂). Vertex h = −b ÷ 2a, k = f(h); axis x = h; opens up if a > 0; y-intercept c (5.1). Coefficients up to ±1,000,000.
Test cases: x² − 5x + 6 → 2, 3, (x − 2)(x − 3), vertex (5/2, −1/4); 2x² + x − 3 → −3/2, 1, (2x + 3)(x − 1); x² − 6x + 9 → 3 (double), (x − 3)²; x² + 0.12345x → −0.12345 and 0 (rational); −2x² + 8x − 6 → −2(x − 1)(x − 3); x² − 2x − 2 → 1 ± √3; x² + 3x − 1 → (−3 ± √13)/2; x² + 2x + 5 → −1 ± 2i; 2x² + 3x + 4 → (−3 ± i√23)/4; a = 0 is rejected.
Rounding
The rounding calculator works on the number as exact decimal digits (BigInt, up to 30 digits), never as a binary float, so 1.005 to two places is 1.01. School method: look at the digit to the right of the place; 5 or more adds 1 to the place digit, otherwise it stays; digits to the right are dropped or zeroed (OpenStax Prealgebra 2e, 1.1 and 5.1), applied by this calculator to the size of a negative number (−2.5 → −3, half away from zero; OpenStax covers positive numbers only). Half to even: when the dropped digits are exactly 5 followed by zeros, the kept digit stays if even and goes up if odd (NIST SP 811, B.7.1); OpenStax Chemistry 2e uses the same tie rule for significant figures. Ceiling rounds toward +∞, floor toward −∞, truncate toward zero. Significant figures: nonzero digits, captive zeros and trailing zeros after a decimal point count, leading zeros never do, and trailing zeros in a whole number are treated as not significant (OpenStax Chemistry 2e, 1.5); rounding to n figures keeps n digits from the first nonzero one, re-sizing if rounding carries (9.99 to 2 figures is 10), with scientific notation when trailing zeros would be ambiguous.
Test cases: 843 → 840 (nearest ten); 3.14159 → 3.14; 2.675 → 2.68; 1.005 → 1.01; 9.96 → 10.0; −2.5 → −3 (school), −2 (half to even); 6.9749505 → 6.974950 and 6.9749515 → 6.974952 (half to even, 7 digits, 6 decimal places); 0.004567 → 0.00457 (3 figures); 123,456 → 123,000 = 1.23 × 10⁵; 0.00450 has 3 significant figures.
Decimals and Fractions
The decimal to fraction calculator writes the digits after the point over the place value of the last digit and simplifies by the greatest common factor (OpenStax Prealgebra 2e, 5.1), all in BigInt (up to 18 digits). Repeating decimals are entered with the repeating block in parentheses, or by marking the last 1 to 6 digits as repeating (parentheses win if both are given): with n digits before the block and k in it, x = (all digits − the digits before the block) ÷ (10ⁿ × (10ᵏ − 1)); a decimal that eventually repeats is rational (Common Core 8.NS.A.1). Fraction to decimal divides the top by the bottom (5.3), tracking remainders to find where the digits repeat (shown in parentheses and with a bar). The nearest fraction in halves to 64ths is round(x × D) ÷ D, simplified, shown whenever the exact fraction isn't already on that scale, with how far under or over it is. A trailing "…" is noted and the digits typed are converted exactly.
Test cases: 0.75 = 3/4; 0.625 = 5/8; 4.09 = 4 9/100; 2.125 = 2 1/8; 0.(3) = 1/3; 0.1(6) = 1/6; 0.(142857) = 1/7; 0.(9) = 1; 1.2(34) = 611/495; 3/8 = 0.375; 5/6 = 0.8(3); 2.71 ≈ 2 11/16 (16ths).
Remainder
The remainder calculator divides whole numbers (0 and up, up to 30 digits) in BigInt: quotient = floor(dividend ÷ divisor), remainder = dividend − quotient × divisor, checked as quotient × divisor + remainder = dividend; dividing by zero is undefined (OpenStax Prealgebra 2e, 1.5). Long division steps are shown for dividends up to 12 digits. The mixed number is quotient plus remainder/divisor in lowest terms; the decimal comes from long division with repeating digits detected. Negative numbers aren't accepted, since remainder conventions for them differ.
Test cases: 1,439 ÷ 4 = 359 R 3 (359 3/4, 359.75); 17 ÷ 5 = 3 R 2 (3.4); 10 ÷ 3 = 3 R 1 (3.(3)); 100 ÷ 8 = 12 R 4 (12 1/2); 123456789012345678901234567890 ÷ 7 leaves 0.
Scale Factor
The scale factor calculator uses k = new length ÷ original length and new = original × k, with exact fractions; similar figures have corresponding sides in the same ratio (OpenStax Prealgebra 2e, 9.3). k is shown as a fraction, a new:original ratio (k = a/b → a:b) and a percent; area changes by k² and volume by k³, since they multiply two and three lengths. Scale drawings (Common Core 7.G.A.1): at drawing:real = 1:N, real = drawing × N in the same unit, then converted with 1 in = 2.54 cm, 12 in = 1 ft, 36 in = 1 yd, 63,360 in = 1 mi.
Test cases: 4 → 10 = 5/2 (area 25/4, volume 125/8); 12 → 3 = 1/4 (1:4); 6 × 3/2 = 9; 3 in at 1:48 = 144 in = 12 ft; 5 m at 1:100 = 5 cm on paper; 2 in at 1:87 = 14.5 ft.
Percent Yield
The percent yield calculator uses percent yield = actual yield ÷ theoretical yield × 100% (OpenStax Chemistry 2e, 4.4), solved for whichever value is left blank: actual = theoretical × percent ÷ 100, theoretical = actual ÷ (percent ÷ 100). If all three are given, the percent is recalculated. The shortfall is theoretical − actual. An actual yield or percent of 0 is allowed (theoretical yield must be above 0). Results above 100% get a note. Example 4.13's theoretical yield: 1.274 g ÷ 159.62 g/mol × 1 × 63.55 g/mol = 0.5072 g Cu.
Test cases: 0.392 g of 0.5072 g = 77.29% (OpenStax Example 4.13, 77.3%); 15 of 20 = 75%; theoretical 50 at 80% = 40; actual 40 at 80% = 50.
Area of a Shape
The area calculator finds the area of one shape from lengths in the chosen unit (mm, cm, m, km, in, ft, yd or mi), then converts it.
- Formulas from sources: square s², rectangle L × W, triangle ½bh, trapezoid ½h(a + b) (OpenStax Prealgebra 2e, 9.4); circle πr², with r = d ÷ 2 from a diameter (9.5); triangle from two sides and the included angle ½ab sin C (OpenStax Algebra and Trigonometry 2e, 10.1) and from three sides by Heron's formula √(s(s − a)(s − b)(s − c)), s = (a + b + c) ÷ 2 (10.2); sector θ ÷ 360 × πr², equal to ½θr² with θ in radians (7.1); ellipse πab with semi-axes a and b (Harvey Mudd Math Fun Facts).
- Derived (explained on the area calculator page): parallelogram b × h; rhombus or kite ½d₁d₂ (perpendicular diagonals); regular polygon n·s² ÷ (4·tan(180° ÷ n)) from n triangles with apothem s ÷ (2·tan(180° ÷ n)); ring π(R² − r²); circle from a circumference C² ÷ (4π), since r = C ÷ (2π).
- Checks: three sides must satisfy the triangle inequality; the included angle is more than 0° and less than 180°; a sector angle is more than 0° and up to 360°; the inner radius of a ring is smaller than the outer; a polygon has 3 to 1,000 sides.
- Units: 1 in = 0.0254 m, 1 ft = 0.3048 m, 1 yd = 3 ft, 1 mi = 5,280 ft; 144 in² = 1 ft², 9 ft² = 1 yd², 43,560 ft² = 1 acre (NIST Handbook 44, Appendix C); 1 ha = 10,000 m² (NIST SP 811). Displayed values keep up to 3 decimals (2 from 1,000 up, 4 significant digits below 1, scientific notation from 1015). Lengths accept thousands commas and a trailing period; comma decimals and values above 1,000,000,000 are rejected with a message.
- Test cases: rectangle 12 × 10 = 120; a 3-4-5 triangle = 6 by base and height, Heron and ½ × 3 × 4 × sin 90°; sides 10 and 8 with 30° = 20; circle r = 5, d = 10 or C = 10π = 78.54; 90° sector of r = 5 = 19.635; ring 5 and 3 = 50.265; ellipse 5 and 3 = 47.124; trapezoid 6, 10, height 4 = 32; rhombus 6 and 8 = 24; hexagon side 2 = 10.392; 100 m × 100 m = 1 ha; 1 mi² = 640 acres.
Square Footage and Area
The square footage calculator adds and subtracts areas:
- Formulas: rectangle length × width, triangle ½ × base × height, trapezoid ½ × (side 1 + side 2) × height (OpenStax Prealgebra 2e, 9.4); circle π r² with r half the diameter (9.5). Irregular shapes are split into these and added, with cut-outs subtracted.
- Lengths are turned into feet first. In feet, feet and inches are accepted (12' 6", 12'-6", 12'6'', 12 ft. 6 in., 12' 6 1/2", or inches alone such as 150"); inches must be under 12. Other units accept a matching suffix (150 in, 5 m). Rows left completely blank are skipped.
- Units: 144 in² = 1 ft², 9 ft² = 1 yd², 43,560 ft² = 1 acre, 1 ft² = 0.092 903 04 m² (NIST Handbook 44, Appendix C).
- Extra adds a percentage; boxes = area with extra ÷ square feet per box, rounded up; cost = area with extra × price per square foot. Up to 20 areas; the total must be above 0.
Test cases: 12 × 12 ft = 144 sq ft = 16 sq yd = 13.378 m²; 12' 6" × 10' 3" = 128.125 sq ft; 20 × 12 + 10 × 8 − 3 × 4 = 308 sq ft; a circle 10 ft across = 78.54 sq ft; 144 sq ft with 10% extra, 20 sq ft boxes and $3.50 per sq ft = 8 boxes and $554.40.
Standard Deviation and Variance
- Sample: s² = Σ(x − x̄)² ÷ (n − 1) and s = √s² (NIST 1.3.5.6). Needs at least 2 values.
- Population: divide by N instead, for data that are the whole population (OpenStax Introductory Statistics 2e, 2.7).
- z-score (standard deviation calculator): (x − mean) ÷ standard deviation, using the sample or population figure the visitor chooses (OpenStax 6.1).
- Display: results are rounded to 12 significant digits and shown with up to 4 decimals (up to 10 with "More decimals"). When every value is the same, the spread is exactly 0 and no z-score is given.
Variance
The variance calculator uses the sample variance s² = Σ(x − x̄)² ÷ (n − 1) (NIST/SEMATECH e-Handbook 1.3.5.6) and the population variance σ² = Σ(x − μ)² ÷ N (OpenStax Introductory Statistics 2e, 2.7), with the same parsing, rounding and deviations table as the standard deviation calculator above. It needs at least 2 values; the step table shows the first 200 rows.
Test cases: 2, 4, 4, 4, 5, 5, 7, 9 → sum of squares 32, sample variance 32/7 = 4.5714, population variance 4; 1, 2, 3, 4, 10 → population SD 3.1623.
Mean Absolute Deviation
The mean absolute deviation calculator uses MAD = Σ|x − x̄| ÷ n, the measure of variability in Common Core 6.SP.B.5c, which NIST calls the average absolute deviation (NIST 1.3.5.6). It also shows NIST's median absolute deviation, median(|x − median|). One value is enough; when every value is the same both are 0.
Test cases: 2, 4, 4, 4, 5, 5, 7, 9 → mean absolute deviation 12 ÷ 8 = 1.5, median absolute deviation 0.5; 1, 2, 3, 4, 10 → 2.4.
Z-Score and the Normal Curve
The z-score calculator uses z = (x − μ) ÷ σ and x = μ + zσ (OpenStax Introductory Statistics 2e, 6.1). The percentile is the area to the left of z under the standard normal curve, P(X < x) (6.2). That area, Φ(z), is computed with Hart's double-precision rational approximation (as published by Graeme West, 2005), checked against reference values such as Φ(1.96) = 0.9750021; the area to the right is 1 − Φ(z), and the area between −|z| and |z| is Φ(|z|) − Φ(−|z|). For a percentile, z is found by bisection on Φ to about 10⁻¹² and snapped to 0 at the 50th percentile. σ must be above 0; a percentile must be strictly between 0 and 100. Areas below 0.0001 are shown in scientific notation, and percents below 0.0001% as "< 0.0001%".
Test cases: x = 17, μ = 5, σ = 6 → z = 2, area to the left 0.9772 (97.72%); z = 1, 2, 3 → areas between 68.27%, 95.45%, 99.73% (empirical rule 68–95–99.7); 90th percentile with μ = 63, σ = 5 → z = 1.2816, x = 69.4078 (OpenStax 69.4); z = 1.96 → 97.5% to the left.
Probability
The probability calculator uses, from OpenStax Introductory Statistics 2e, 3.1: P(A) = outcomes in A ÷ total equally likely outcomes, P(not A) = 1 − P(A), P(A | B) = P(A and B) ÷ P(B); and from 3.3: P(A and B) = P(A) × P(B) for independent events, P(A and B) = 0 for mutually exclusive events, P(A or B) = P(A) + P(B) − P(A and B). Neither = 1 − P(A or B); exactly one = P(A or B) − P(A and B). Repeated tries: at least once = 1 − (1 − p)ⁿ and every time = pⁿ, from the complement (3.1) and the multiplication rule for independent events (3.3); exactly k = C(n, k)·pᵏ·(1 − p)ⁿ⁻ᵏ (4.3), computed with logarithms, with "at most" and "at least" as sums; mean np, standard deviation √(np(1 − p)).
- Inputs: decimals, percents, fractions or "1 in N", between 0 and 1. Two-event results are exact fractions (BigInt) and shown as fractions when any input was a fraction; otherwise as decimals. If an exact fraction would be too large (more than 2⁵³), the calculation switches to floating point and steps use ≈. Up to 4 decimals; below 0.0001 in scientific notation.
- Checks: mutually exclusive events need P(A) + P(B) ≤ 1; a given P(A and B) must be between P(A) + P(B) − 1 and the smaller of P(A) and P(B). Single event: whole numbers, favorable ≤ total. Repeated tries: 1 to 10,000 tries, 0 ≤ k ≤ n.
- Test cases: 2 of 6 = 1/3; 1/2 and 1/6 independent → both 1/12, at least one 7/12, neither 5/12, exactly one 1/2; 0.6 and 0.35 mutually exclusive → 0.95, neither 0.05 (OpenStax Example 3.14); 50%, 40%, 20% → or 0.7, P(A | B) 0.5, independent; a six at least once in 10 rolls 0.8385, exactly two 0.2907; B(20, 0.41) at most 12 = 0.9738 (OpenStax Example 4.13).
Exponents
The exponent calculator uses bⁿ = b used as a factor n times (OpenStax Elementary Algebra 2e, 6.2); b⁰ = 1 for b ≠ 0 (6.5); b⁻ⁿ = 1/bⁿ (6.7); b^(m/n) = (ⁿ√b)ᵐ, with no real value for an even root of a negative number (Intermediate Algebra 2e, 8.3); bˣ = y ⇔ x = log_b y = log y ÷ log b (College Algebra 2e, 6.3, 6.5).
- Exact arithmetic: bases and exponents are read as exact fractions (decimals up to 60 digits). Integer powers are computed in BigInt; results up to 40 digits are shown in full, larger ones in scientific notation (and from logarithms beyond about 20,000 digits). Fractional exponents are exact when the root is exact; otherwise a decimal to 10 significant digits plus a simplified radical when the radicand is at most 10¹⁵.
- Solving: an exponent that is a whole number or a fraction with denominator up to 12 is confirmed exactly (bᵖ = y^q in BigInt); otherwise a 10-digit decimal. For the base, an even power (or a fractional exponent with an even numerator and odd denominator) gives ± bases, and a negative result is rejected when the exponent needs an even root or an even power. This calculator leaves 0⁰ undefined (the zero exponent rule needs a ≠ 0; some fields define 0⁰ = 1); 0 to a negative power is undefined. Integers over 40 digits are shown approximately in scientific notation, with every digit listed up to 2,000 digits; terminating decimals are shown exactly.
- Test cases: 2⁵ = 32; 2⁻³ = 1/8; (−5)⁴ = 625; (3²)³ = 729; 2¹⁰⁰ = 1,267,650,600,228,229,401,496,703,205,376; 25^(1/2) = 5, 256^(1/4) = 4, 16^(−3/2) = 1/64 (OpenStax 8.3); 8^(2/3) = 4; 12^1.5 = 24√3 ≈ 41.569; (−16)^(1/4) not real; 2ˣ = 32 → 5; 8ˣ = 2 → 1/3; b⁴ = 81 → ±3; b^(1/2) = −3 and b^(3/2) = −8 have no real base; b^(2/3) = 4 → ±8; 2⁴⁰ = 1,099,511,627,776 = 1.099511627776 × 10¹².
Scientific Notation
The scientific notation calculator writes a number as a × 10ⁿ with 1 ≤ |a| < 10 and n an integer, converts by moving the decimal point, multiplies by multiplying the numbers and adding exponents, and divides by dividing and subtracting (OpenStax Elementary Algebra 2e, 6.7). Addition and subtraction align both numbers to the same power of 10 (OpenStax Chemistry 2e, Appendix B). E notation follows Excel's Scientific format, aE±n = a × 10ⁿ (Microsoft Support).
- Arithmetic is exact in BigInt decimals; division keeps 30 significant digits and shows a non-terminating result rounded to 15. Optional rounding to 1–30 significant figures, halves away from zero, shown as a separate last step; trailing zeros of a whole number are reported as possibly not significant (Chemistry 2e, 1.5). "×10" must be followed by ^ (or a superscript), so "3 × 100" is rejected rather than read as 3 × 10⁰; "5 × 10" means 5 × 10¹. Inputs: plain numbers with thousands commas, a × 10^n, a x 10^n, superscript exponents, and aEn; up to 1,000 digits and exponents up to ±1,000,000. Decimal form is shown when it's 120 characters or fewer.
- Test cases: 37,000 = 3.7 × 10⁴; 0.0052 = 5.2 × 10⁻³; 6.2 × 10³ = 6,200; 8.9 × 10⁻² = 0.089; (4 × 10⁵)(2 × 10⁻⁷) = 8 × 10⁻²; (9 × 10³) ÷ (3 × 10⁻²) = 3 × 10⁵ (all OpenStax 6.7); 12,345,678,901 to 3 significant figures = 1.23E+10 (Microsoft); 3.2 × 10⁴ + 5 × 10³ = 3.7 × 10⁴; 5.00 × 10⁻⁵ + 3.00 × 10⁻³ = 3.05 × 10⁻³ (OpenStax Chemistry 2e, Example B1); 9.995 to 3 significant figures = 1.00 × 10¹ = 10.0; 99,999 to 2 = 1.0 × 10⁵; 1.23456 × 10³ to 2 = 1.2 × 10³; 37 × 10³ = 3.7 × 10⁴.
Percentiles and Quartiles
The percentile calculator sorts the data and finds the value at the kth percentile three ways:
- Textbook (default): i = (k/100)(n + 1); a whole i gives the ith value, otherwise the average of the values in positions ⌊i⌋ and ⌈i⌉ (OpenStax Introductory Statistics 2e, 2.3). Below position 1 or above n, the smallest or largest value is used (our convention; the textbook doesn't cover it).
- NIST: p(n + 1) = j + d and Y[j] + d(Y[j+1] − Y[j]), with the minimum for j = 0 and the maximum for j ≥ n (NIST/SEMATECH e-Handbook, 7.2.6.2). Excel's PERCENTILE.EXC uses the same position but errors at the extremes (Microsoft).
- Excel PERCENTILE.INC: 1 + p(n − 1) = j + d, interpolated the same way (NIST 7.2.6.2; Microsoft).
- Percentile of a value: (x + 0.5y) ÷ n × 100, with x values below and y equal (OpenStax 2.3); also the share below and at or below, and Excel's PERCENTRANK.INC: values below ÷ (n − 1), interpolated for values not in the data, cut to 3 digits, not shown outside the data's range (Microsoft; its examples on 13, 12, 11, 8, 4, 3, 2, 1, 1, 1 give 0.333, 0.555, 0.666 and 0.583). Quartiles: Q2 the median, Q1 and Q3 the medians of the lower and upper halves (the median left out when n is odd), IQR = Q3 − Q1, potential outliers beyond 1.5 × IQR (OpenStax 2.3). At least 2 values for quartiles; the quartile mode also shows Excel PERCENTILE.INC at the 25th and 75th percentiles.
- Test cases: OpenStax's 29 actor ages, 70th = 64 (Excel 63.2, NIST 64) and 83rd = 71.5 (Excel 71.24, NIST 71.9); age 58 → 63.79, about the 64th; 1, 3, 2, 4 at the 30th by PERCENTILE.INC = 1.9 (Microsoft); OpenStax's 13 house prices → Q1 308,750, Q3 649,000, IQR 340,250, upper fence 1,159,375, 5,500,000 a potential outlier; actor ages Q1 29.5, median 47, Q3 68 (PERCENTILE.INC 30 and 67); PERCENTRANK.INC of 58 = 0.642.
Matrices
The matrix calculator and the matrix multiplication calculator share one engine. It does exact arithmetic on fractions (BigInt numerators and denominators), so results never pick up rounding error. Decimals are shown only alongside, rounded to 4 decimal places (very small values to 4 significant figures).
- A ± B: entry by entry, same size only. kA: every entry times k. AB: A m × r and B r × n give m × n; entry (i, j) is the sum of A[i][k] × B[k][j] (OpenStax Algebra and Trigonometry 2e, 11.5). Aᵀ: (Aᵀ)ᵢⱼ = Aⱼᵢ (MIT 18.06SC).
- Determinant: 2 × 2 by ad − bc; 3 × 3 by the diagonal (repeated-columns) method (OpenStax 11.8); 4 × 4 and up by elimination: row swaps flip the sign, adding a multiple of one row to another keeps it, and the result is the product of the pivots (MIT 18.06SC, Properties of determinants).
- Inverse: 2 × 2 by 1/(ad − bc) × [[d, −b], [−c, a]]; 3 × 3 and up by Gauss–Jordan elimination on [A | I] (OpenStax 11.7). No pivot in a column means det A = 0 and no inverse. Every inverse is checked by multiplying A × A⁻¹ and comparing with I.
- Aⁿ: repeated products for whole n from 0 to 20; A⁰ = I. Sizes up to 8 × 8. The steps show every entry of a sum, scalar multiple or product (up to 64) and every row operation; for a power they show A² entry by entry. No thousands commas in results or decimals, because commas separate entries in the input.
- Test cases: OpenStax 11.5 Ex 3 sum [[9, 10], [3, 9]], Ex 4 difference [[−10, 2], [−5, −3]], Ex 6 3A = [[24, 3], [15, 12]], Ex 9 AB = [[−7, 10], [30, 11]] and BA = [[−9, 10, 10], [4, −8, −12], [10, 4, 21]]; 11.7 Ex 4 inverse [[−3, 2], [−2, 1]], Ex 5 no inverse, Ex 6 inverse [[−1, 1, 0], [−1, 0, 1], [6, −2, −3]]; 11.8 Ex 1 det 27, Ex 3 det 6, upper triangular det −2; MIT transpose [[1, 2, 4], [3, 3, 1]]; a 4 × 4 determinant of 72 checked by cofactor expansion.
GCF and LCM Worksheets
The GCF and LCM worksheets are generated, not typed by hand. A seeded random generator (mulberry32) picks the numbers, so every set can be rebuilt exactly from its set number: the PDFs, the on-page generator and shared links all show the same problems.
- Ranges (Common Core 6.NS.B.4): GCF pairs up to 100, LCM pairs up to 12, and distributive-property sums of two numbers up to 100 written as GCF × (a sum with no common factor), like 36 + 8 = 4(9 + 2) (Common Core 6.NS.B.4). The mixed sheet uses pairs up to 36 and the word problems GCF numbers up to 96 and LCM numbers up to 12; the challenge sheet (three-number GCFs up to 120, LCMs of 10 to 30) is labeled beyond grade 6.
- Answer keys: each answer lists the prime factorization of every number and takes shared primes at their lowest power for the GCF, every prime at its highest power for the LCM (OpenStax Prealgebra 2e, 2.5; Elementary Algebra 2e, 7.1). The mixed sheet also checks GCF × LCM = the product of the pair.
- Word problems: eight original problems, four GCF situations (equal groups, largest square tile) and four LCM situations (packs that must match, cycles that line up), with the numbers chosen so every answer is a whole number. The key names the reason for each one (most equal groups, biggest equal piece, smallest amount both packs make, cycles lining up).
- Test cases: every answer in 40 seeded GCF and LCM sets and 30 sets of every other type is recomputed independently with Euclid's algorithm in the test suite; every type is checked against its stated range and for repeated problems.
Tips
The tip calculator works in whole cents. The tip is the base times the percentage, rounded half up to the cent; the base is the bill before tax, or the bill plus tax if you choose. The total is the bill plus tax plus tip.
- Splitting: the total is divided by the number of people; any leftover cents go one each to some people, so the shares add up exactly (for example $118.00 ÷ 3 = $39.33, with one person paying $39.34).
- Rounding up: each share goes up to the next whole dollar and the difference is added to the tip.
- Test cases: 20% of $80 = $16.00 (total $96.00); with $6.40 tax, 20% of $86.40 = $17.28; 15% of $47.30 = $7.10 (7.095 rounds up); 18.5% of $50 = $9.25; $47.30 + $3.78 tax at 15% split 4 ways and rounded up = $15.00 each, tip $8.92.
Age
- Birthday rule: an age goes up by one year on each birthday (Md. Code, General Provisions § 1-303(a)). Years are the birthdays reached; months are whole months since the last birthday, counted from the same day of the month; days are the rest.
- Short months: a monthly date on the 29th, 30th or 31st falls on the last day of a shorter month.
- February 29 births: March 1 in years that aren't leap years (§ 1-303(b)), or February 28 if the visitor chooses it.
- Social Security age: one day earlier, on "the first moment of the day preceding the anniversary" of birth (SSA POMS GN 00302.400).
- Dates: calendar dates are compared in UTC, so time zones and daylight saving time never change a day count. "Today" is the visitor's own local date. Dates from 1900 through 2100 are accepted.
Percentages
- Percent of a number, what percent, and the whole: P% of X = (P ÷ 100) × X; percent = part ÷ whole × 100; whole = part ÷ (P ÷ 100). "Of" means multiply and "is" means equals (OpenStax, Prealgebra 2e, 6.2).
- Percent increase and decrease: the change as a percent of the original amount (same source). Increasing or decreasing a number by P% multiplies it by 1 + P ÷ 100 or 1 − P ÷ 100; taking more than 100% off isn't allowed. A change to a negative value can be a decrease of more than 100%, and the calculator notes it.
- Percent off: discount = original price × rate; sale price = original − discount (OpenStax, Prealgebra 2e, 6.3). A second discount applies to the reduced price.
- Percent error: |measured − expected| ÷ |expected| × 100 (OpenStax, Contemporary Mathematics, 6.1). The calculator also shows the signed error.
- Percent difference: |a − b| ÷ ((a + b) ÷ 2) × 100, the lab convention in Clemson University's physics tutorial; it's only for positive values, and order doesn't matter.
- Not allowed: a whole, original value, or expected value of 0 (each is a denominator); a percent off below 0 or above 100.
Input Rules
- Numbers can be separated by commas, spaces, tabs, semicolons, or new lines.
- A token like 1,234 or 12,345.6 (commas every three digits) is read as one number with thousands separators. Otherwise a comma separates numbers, so 5,6 is two numbers. When a token is read this way, the calculator shows a note, so a list typed as 100,250,300 without spaces doesn't silently become one number.
- A leading $ and a trailing % are removed; the minus sign (−) and en dash (–) are read as a negative sign.
- Anything else that isn't a number is ignored and listed, so you can fix it. Up to 10,000 numbers per calculation.
- Weighted average: rows with both fields blank are skipped; weights must be 0 or more, with at least one above 0.
How Results Are Rounded for Display
Calculations use full double-precision arithmetic. Results are trimmed to 12 significant digits to remove binary rounding noise (so 0.1 + 0.2 shows as 0.3), then displayed with up to 4 decimals, or up to 10 with "More decimals" on the average and mean, median, mode calculators. The weighted average calculator shows up to 4 decimals.
Test Cases
Every change to the calculation engine must pass these cases before release. They run automatically with Node's built-in test runner against the same engine file the calculators load in your browser.
| # | Input | Expected |
|---|---|---|
| 1 | 85, 90, 78, 92, 88 | Mean 86.6, median 88, no mode, range 14, sum 433 |
| 2 | 2, 4, 4, 4, 5, 5, 7, 9 | Mean 5, median 4.5, mode 4 (3 times), population SD 2, sample SD 2.1381 |
| 3 | 1, 1, 2, 2, 3 | Modes 1 and 2 |
| 4 | 0.1, 0.2 | Mean 0.15, sum 0.3 |
| 5 | "1,234 5,6"; "12,345.5, $7, 80%"; "10 $1,200, $3" | 1234, 5, 6; 12345.5, 7, 80; 10, 1200, 3 |
| 6 | Weighted: 92 × 20, 85 × 30, 78 × 50 | 82.9 (simple average 85) |
| 7 | Weighted: 10 × 100, 12 × 50 | 10.6667 |
| 8 | 300,000; 320,000; 350,000; 360,000; 2,000,000 | Mean 666,000, median 350,000 |
| 9 | Weighted: 4.8 × 20, 4.2 × 300, 4.5 × 80 | 4.29 (simple average 4.5) |
| 10 | "100,250,300" | One value, 100250300, flagged as read with thousands commas |
| 11 | LCM/GCF: 12, 18 · 8, 12 · 6, 10 | GCF 6, 4, 2; LCM 36, 24, 30 |
| 12 | LCM/GCF: 15, 20 · 15, 18 (OpenStax Examples 2.52, 2.53) | LCM 60, 90; GCF 5, 3 |
| 13 | LCM/GCF: 24, 36, 60 · 9, 28 | GCF 12, LCM 360; GCF 1 (relatively prime), LCM 252 |
| 14 | Euclid: 1,071, 462 | 1,071 = 2 × 462 + 147; 462 = 3 × 147 + 21; 147 = 7 × 21 + 0 → GCF 21, LCM 23,562 |
| 15 | 360; 1,000,000,000,000 and 999,999,999,989 | 2³ × 3² × 5; GCF 1, LCM 999,999,999,989,000,000,000,000 (exact) |
| 16 | Age: born 1/1/1962, on 12/31/2026 (SSA POMS GN 00302.400 example) | Social Security age 65; ordinary age 64 (65 on 1/1/2027) |
| 17 | Age: born 2/29/2004, on 2/28/2022 and 3/1/2022 (§ 1-303(b)) | 17, then 18 on March 1; 18 on February 28 with the February 28 option |
| 18 | Age: born 5/20/1990, on 11/4/2026; born 1/31/2026, on 2/28/2026 and 3/31/2026 | 36 years, 5 months, 15 days; 1 month 0 days; 2 months 0 days |
| 19 | Age: born 1/1/2000, on 11/4/2026 | 9,804 days (1,400 weeks and 4 days), born on a Saturday, next birthday Friday 1/1/2027 in 58 days |
| 20 | Age difference: 3/10/1988 and 7/25/1991 | 3 years, 4 months, 15 days |
| 21 | Age: born 11/4/1990, on 11/4/2026; born and checked on 11/4/2026; year 0019 | 36, birthday today, next birthday 11/4/2027 in 365 days; age 0, not a birthday; rejected (outside 1900–2100) |
| 22 | Standard deviation: the 20 ages of OpenStax Example 2.32 (9 to 11.5) | Mean 10.525, sum of squares 9.7375, sample variance 0.5125, s = 0.7159 (0.72), population variance 0.486875 |
| 23 | Standard deviation: 2, 4, 4, 4, 5, 5, 7, 9; one value, 5 | Sum of squares 32, σ = 2, s² = 4.5714; one value: σ = 0, no sample SD |
| 24 | z-score of 9 in 2, 4, 4, 4, 5, 5, 7, 9; z-score of 0.1 in 0.1, 0.1, 0.1 | 2 (population SD), 1.8708 (sample SD); 0.1, 0.1, 0.1 has standard deviation exactly 0 and no z-score |
| 25 | 35% of 90 (OpenStax Example 6.14); 125% of 28 (same section); 9 is what % of 36 (6.18); 36 is 75% of what (6.16); 6.5% of what is 1.17 | 31.5; 35; 25%; 48; 18 |
| 26 | Percent change $26 → $36 (OpenStax Example 6.23); $3.71 → $3.64 (6.24); from 0 | 38.46% increase (38.5%); 1.89% decrease (1.9%); rejected |
| 27 | Percent off: $140 at 35% (OpenStax Example 6.30); $31 → $13.95 (6.31); $100 at 20% then 10% | $49 off, $91; $17.05 off, 55%; $72, 28% off in total |
| 28 | Percent error: 48.7 vs. expected 50; 9.457 vs. 9.807 (OpenStax Contemporary Mathematics 6.1, Exercises 24–25, answers worked from the formula) | 2.6%; 3.5689% |
| 29 | Percent difference: 10 and 12; 12 and 10; 40 and 50 | 18.18%; 18.18%; 22.22% |
Known Limits
- Values with units (such as "5 kg") must be entered as plain numbers.
- The geometric mean is computed internally only when every value is positive.
- European decimal commas (3,5 for 3.5) aren't supported; use a decimal point.
Update Log
- November 13, 2026: Added the variance, mean absolute deviation, z-score, probability, exponent, scientific notation, percentile, matrix and matrix multiplication calculators and their formulas above.
- November 14, 2026: Added the GCF and LCM worksheets and how they're generated, and the tip calculator.
- November 6, 2026: Added the percent calculators (percentage, increase, decrease, percent off, percent difference, percent error), their formulas, and test cases 25 to 29.
- November 4, 2026: Added the standard deviation calculator, its formulas, and test cases 22 to 24.
- November 4, 2026: Added the age calculator, the age rules above, and test cases 16 to 21.
- November 2, 2026: Added the LCM and GCF calculators and test cases 11 to 15.
- November 2, 2026: Added a note when a list is read with thousands commas; added test cases 9 and 10.
- November 2, 2026: First release of the average, mean/median/mode, and weighted average calculators and this methodology.
Found an error? Tell us through our contact page. Corrections are listed here with the date.