← All tool references

Math · execute

Percentage Calculator

Calculate a percentage of a value, determine what percentage a part is of a whole, or measure relative percentage change.

Open public tool

Overview

Category
Math
API mode
execute
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/percentage-calculator

View this descriptor as JSON

Execute availability

This tool has an execute route defined by its descriptor. Server-side execution is currently unavailable, so requests return api_not_launched.

POST /api/v1/tools/percentage-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

mode · string · required
Choose which calculation or conversion direction you need. Accepted values: percent_of, what_percent, percent_change.
a · number · required
Enter the first percentage value. Its meaning changes with the percentage mode selected.
b · number · required
Enter the comparison value used by the selected percentage mode.
{
    "type": "object",
    "properties": {
        "mode": {
            "type": "string",
            "enum": [
                "percent_of",
                "what_percent",
                "percent_change"
            ],
            "description": "Choose which calculation or conversion direction you need."
        },
        "a": {
            "type": "number",
            "description": "Enter the first percentage value. Its meaning changes with the percentage mode selected."
        },
        "b": {
            "type": "number",
            "description": "Enter the comparison value used by the selected percentage mode."
        }
    },
    "required": [
        "mode",
        "a",
        "b"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

result · number
Percentage result for the selected mode.
mode · string
Browser-calculated mode.
{
    "type": "object",
    "properties": {
        "result": {
            "type": "number",
            "description": "Percentage result for the selected mode."
        },
        "mode": {
            "type": "string",
            "description": "Browser-calculated mode."
        }
    },
    "additionalProperties": false
}

Percentage Calculator: 25% of 200

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/percentage-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "percent_of",
    "a": 25,
    "b": 200
}'
{
    "ok": true,
    "data": {
        "slug": "percentage-calculator",
        "result": {
            "values": {
                "result": 50,
                "mode": "percent_of"
            },
            "display": {
                "display": "50"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.