← All tool references

Math · not_available

Margin of Error Calculator

Estimate a proportion margin of error from sample size.

Open public tool

Overview

Category
Math
API mode
not_available
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/margin-of-error-calculator

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/margin-of-error-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.

sample_size · number · required
Enter sample size for this calculation.
confidence_level · number · required
Enter confidence level for this calculation.
sample_proportion · number · required
Enter sample proportion for this calculation.
population_size · number · required
Enter population size (0 for unlimited) for this calculation.
{
    "type": "object",
    "properties": {
        "sample_size": {
            "type": "number",
            "description": "Enter sample size for this calculation.",
            "minimum": 2
        },
        "confidence_level": {
            "type": "number",
            "description": "Enter confidence level for this calculation."
        },
        "sample_proportion": {
            "type": "number",
            "description": "Enter sample proportion for this calculation."
        },
        "population_size": {
            "type": "number",
            "description": "Enter population size (0 for unlimited) for this calculation.",
            "minimum": 0
        }
    },
    "required": [
        "sample_size",
        "confidence_level",
        "sample_proportion",
        "population_size"
    ],
    "additionalProperties": false
}

Output schema

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

margin_of_error · number
Margin of error calculated by the tool.
lower_bound · number
Lower confidence bound calculated by the tool.
upper_bound · number
Upper confidence bound calculated by the tool.
standard_error · number
Standard error calculated by the tool.
{
    "type": "object",
    "properties": {
        "margin_of_error": {
            "type": "number",
            "description": "Margin of error calculated by the tool."
        },
        "lower_bound": {
            "type": "number",
            "description": "Lower confidence bound calculated by the tool."
        },
        "upper_bound": {
            "type": "number",
            "description": "Upper confidence bound calculated by the tool."
        },
        "standard_error": {
            "type": "number",
            "description": "Standard error calculated by the tool."
        }
    },
    "additionalProperties": false
}

Margin of Error Calculator worked example

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/margin-of-error-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "sample_size": 385,
    "confidence_level": 95,
    "sample_proportion": 50,
    "population_size": 0
}'
{
    "ok": true,
    "data": {
        "slug": "margin-of-error-calculator",
        "result": {
            "values": {
                "margin_of_error": 4.99454200000000003711875251610763370990753173828125,
                "lower_bound": 45.00545799999999729834598838351666927337646484375,
                "upper_bound": 54.99454200000000270165401161648333072662353515625,
                "standard_error": 0.0254820000000000011775025399174410267733037471771240234375
            },
            "display": {
                "display": "4.994542"
            },
            "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.