Math Expression Calculator Online
Evaluate math expressions safely: units (5 cm to inch), matrices, statistics, variables, big numbers or exact fractions, with formatted result and LaTeX.
Result
Press “Run” to see the result.
Send an expression in expr (GET or POST) or a batch in expressions (up to 100, sharing variables: a = 5, then a * 2). The evaluator is mathjs with a restricted function set: arithmetic, powers and roots, logarithms, rounding, trigonometry, gcd / lcm, factorial and combinations, statistics (mean, median, std, variance, quantile…), matrices (det, inv, transpose, dot, cross), comparisons and logic, complex numbers, constants and units with conversion (100 km/h to m/s, 5 cm + 2 inch to mm, 10 kg * 9.81 m/s^2 to N). You can define functions (f(x) = x^2 + 1) and pass variables in scope (numbers, arrays or strings such as "42 km").
number=bignumber computes with 64 significant digits (precision 16–256), number=fraction gives exact fractions (1/3 + 1/6 → 1/2). Each result comes as a formatted string (digits significant digits, 15 by default), a JSON value, its type and the LaTeX of the expression for display.
Safety: import, createUnit, evaluate, parse, simplify, derivative and other meta functions are disabled, property access to constructors is blocked by mathjs, expressions are limited to 2,000 characters, matrices and ranges to 100,000 elements, factorial to 100,000 and exact powers to exponent 10,000; a batch stops after 2 seconds.
Use this in your code
curl "https://apibox.io.vn/v1/math-eval?expr=5%20cm%20%2B%202%20inch%20to%20mm" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/math-eval?expr=5%20cm%20%2B%202%20inch%20to%20mm', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/math-eval?expr=5%20cm%20%2B%202%20inch%20to%20mm",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/math-eval?expr=5%20cm%20%2B%202%20inch%20to%20mm');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Why does 0.1 + 0.2 show 0.3?
The formatted result uses 15 significant digits; value keeps the raw double (0.30000000000000004). Use number=bignumber for exact decimal arithmetic.
Can expressions run code?
No: only math functions are available, meta functions such as import or evaluate are disabled and JavaScript properties cannot be reached.
Which units are supported?
All built-in mathjs units: length, mass, time, speed, area, volume, temperature, force, energy, power, pressure, data (bit, byte) and SI prefixes. Currencies are not included.