Body Fat Calculator API: The Complete Guide

Need to calculate body fat percentage in your fitness or health application? This guide covers everything you need to know about body fat calculation via API, including different methods, parameters, and implementation examples in multiple languages.

What is Body Fat Percentage?

Body fat percentage is the proportion of your total body weight that is fat tissue. Unlike BMI, body fat percentage distinguishes between fat mass and lean mass (muscle, bone, organs, water), providing a more accurate picture of body composition.

Healthy body fat ranges vary by gender: typically 10-20% for men and 18-28% for women. Athletes often have lower percentages.

Calculation Methods Explained

Several methods can estimate body fat percentage:

US Navy Method

Uses circumference measurements (neck, waist, and hips for women). Developed by the US Navy and validated for accuracy. Requires only a tape measure.

BMI-Based Estimation

Uses a formula correlating BMI with body fat percentage. Less accurate but requires only height and weight.

Skinfold Method

Uses caliper measurements at specific body sites. More accurate when performed correctly but requires special equipment.

Recommendation: The US Navy method offers the best balance of accuracy and ease of measurement for most applications.

Using the Body Fat Calculator API

TinyFn provides a simple endpoint to calculate body fat percentage:

API Request
GET https://api.tinyfn.io/v1/health/body-fat?gender=male&height=175&waist=85&neck=38
Headers: X-API-Key: your-api-key
Response
{
  "body_fat_percentage": 18.5,
  "method": "navy",
  "category": "fitness",
  "fat_mass_kg": 13.0,
  "lean_mass_kg": 57.0,
  "healthy_range": {
    "min": 10,
    "max": 20
  },
  "inputs": {
    "gender": "male",
    "height_cm": 175,
    "waist_cm": 85,
    "neck_cm": 38
  }
}

Parameters

Parameter Type Description
gender string Gender: male or female
height number Height in centimeters
waist number Waist circumference in centimeters
neck number Neck circumference in centimeters
hip number Hip circumference in cm (required for female)
weight number Weight in kg (optional, for mass calculations)

Code Examples

JavaScript / Node.js

const response = await fetch(
  'https://api.tinyfn.io/v1/health/body-fat?gender=male&height=175&waist=85&neck=38',
  { headers: { 'X-API-Key': 'your-api-key' } }
);
const data = await response.json();
console.log(`Body fat: ${data.body_fat_percentage}%`); // Body fat: 18.5%

Python

import requests

response = requests.get(
    'https://api.tinyfn.io/v1/health/body-fat',
    params={'gender': 'male', 'height': 175, 'waist': 85, 'neck': 38},
    headers={'X-API-Key': 'your-api-key'}
)
data = response.json()
print(f"Body fat: {data['body_fat_percentage']}%, Category: {data['category']}")

cURL

curl "https://api.tinyfn.io/v1/health/body-fat?gender=male&height=175&waist=85&neck=38" \
  -H "X-API-Key: your-api-key"

Common Use Cases

  • Fitness Tracking Apps: Monitor body composition changes over time
  • Personal Training Platforms: Track client progress beyond just weight
  • Health Assessments: Evaluate cardiovascular and metabolic health risks
  • Weight Loss Programs: Ensure fat loss vs. muscle loss
  • Athletic Performance: Optimize body composition for sports

Best Practices

  1. Consistent measurements: Measure at the same time of day, same conditions
  2. Track trends: Focus on changes over time, not single measurements
  3. Show categories: Display fitness categories (essential, athletic, fitness, average)
  4. Provide context: Explain healthy ranges for user's gender and age

Use via MCP

Your AI agent can call this tool directly via Model Context Protocol — no HTTP code needed. Add TinyFn to Claude Desktop, Cursor, or any MCP client:

{
  "mcpServers": {
    "tinyfn-health": {
      "url": "https://api.tinyfn.io/mcp/health/",
      "headers": {
        "X-API-Key": "your-api-key"
      }
    }
  }
}

See all health tools available via MCP in our Health MCP Tools for AI Agents guide.

Try the Body Fat Calculator API

Get your free API key and start calculating body fat in seconds.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key