math.tools / API

Math Tools for developers

A little less math code.
A lot more possibility.

Explore numbers, turn equations into images, and give AI agents access to mathematical tools. Start with a REST request or connect through MCP.

REST base URL   https://api.math.tools

01 / Numbers

Numbers API

Check number properties, find prime factors, convert between bases and numeral systems, spell out numbers, and retrieve digits of pi. Responses are JSON.

Example: is 17 prime?

curl --get 'https://api.math.tools/numbers/prime/is-prime' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Accept: application/json' \
  --data-urlencode 'number=17'

Requires a Numbers API subscription token with the numbers:* ability.

02 / Equation rendering

Equa Images API

Render mathematical formulas as PNG images. Get a base64-encoded image in JSON, or request raw PNG bytes with binary=1. Supports GET and POST.

Example: save an equation as a PNG

curl --get 'https://api.math.tools/equations/image' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --data-urlencode 'formula=x^2+y^2=z^2' \
  --data-urlencode 'fontsize=24' \
  --data-urlencode 'binary=1' \
  --output equation.png

Requires an Equa Images API subscription token with the equations:image ability.

Your first authenticated request

Choose a plan from the API’s pricing page and sign in to subscribe. Your subscription issues a personal access token. Use that token on each REST request; the REST APIs require authentication.

Keep tokens private and send requests over HTTPS. Usage allowances and rate limits depend on your plan.

Authorization: Bearer YOUR_TOKEN

On this host, REST paths start with /numbers or /equations. The reference pages also document the website endpoints under https://math.tools/api.

03 / AI integrations

Math Tools MCP server

Connect an MCP-compatible client to the existing Math Tools server for number theory, numeral conversion, and equation rendering. It uses JSON-RPC 2.0 over HTTP.

The tool catalog is public to discover. Calling a tool requires a bearer token with the appropriate ability.

Server endpoint

https://math.tools/mcp/math-tools

See the connection guide for client setup, subscription tokens, and x402 token purchasing options.