Math expression calculator: evaluate a formula safely
No account. Pay by card from $1 and your key appears right after payment. Get a key by card
Evaluate an arithmetic expression safely (parsed, never executed as code): + - * / % ^ and **, parentheses, factorial !, constants pi, e and tau, and functions sqrt, cbrt, abs, round, floor, ceil, exp, ln, log (base 10), log2, sin, cos, tan, asin, acos, atan (radians), min, max and pow. Up to 500 characters. Use when an agent needs exact arithmetic instead of guessing, for prices, unit maths or formulas.
$0.001 per call with prepaid credits: $1 by card pays for 1,000 calls, with no account and no subscription.
Inputs
| Name | Type | Description |
|---|---|---|
expression (required) | string | The expression, such as (2+3)*4^2/sqrt(16) |
Request
Over HTTP, with a card key from /credits:
curl -H "Authorization: Bearer adt_…" "https://glyphtools.com/math/evaluate?expression=(1500%20*%200.045%20%2F%2012)%20%2B%20sqrt(144)%20-%202%5E3"
Node.js
const r = await fetch("https://glyphtools.com/math/evaluate?expression=(1500%20*%200.045%20%2F%2012)%20%2B%20sqrt(144)%20-%202%5E3", {
headers: { Authorization: "Bearer adt_…" },
});
const data = await r.json(); // 402 until the key is in the header
Python
import requests
r = requests.get("https://glyphtools.com/math/evaluate?expression=(1500%20*%200.045%20%2F%2012)%20%2B%20sqrt(144)%20-%202%5E3", headers={"Authorization": "Bearer adt_…"}, timeout=60)
data = r.json()
Or one of your 3 free calls, no key — the same request with &trial=1 on the end:
curl "https://glyphtools.com/math/evaluate?expression=(1500%20*%200.045%20%2F%2012)%20%2B%20sqrt(144)%20-%202%5E3&trial=1"
Without a key, the same URL answers 402 Payment Required with x402 and MPP terms, so an agent with a wallet pays per call in USDC (Base, Polygon, Arbitrum or Solana over x402; Base or Tempo over MPP) and retries.
Example result
{
"expression": "(1500 * 0.045 / 12) + sqrt(144) - 2^3",
"value": 9.625,
"finite": true
}
From an AI agent (MCP)
Add the MCP server to Claude, Cursor or any MCP client. This tool is math_evaluate, and the first 10 successful calls are free:
https://glyphtools.com/mcp