The U.S. Navy body fat percentage formula is a widely used method for estimating body fat. It requires a few simple body measurements, along with your height and neck circumference. This calculator uses the standard Navy method formulas.
Male
Female
.calculator-container {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 500px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
margin-bottom: 15px;
color: #333;
}
.calculator-container p {
margin-bottom: 20px;
line-height: 1.6;
color: #555;
}
.calculator-inputs {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.input-group {
display: flex;
flex-direction: column;
}
.input-group label {
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.input-group input[type="number"],
.input-group select {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Ensure padding doesn't affect width */
}
.calculator-container button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.calculator-container button:hover {
background-color: #45a049;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
background-color: #e7f3e7;
border: 1px solid #d4edda;
color: #155724;
border-radius: 4px;
text-align: center;
font-size: 18px;
font-weight: bold;
}
.calculator-result span {
font-weight: normal;
color: #28a745;
}
function calculateBodyFatNavy() {
var weightKg = parseFloat(document.getElementById("weightKg").value);
var heightCm = parseFloat(document.getElementById("heightCm").value);
var neckCm = parseFloat(document.getElementById("neckCm").value);
var waistCm = parseFloat(document.getElementById("waistCm").value);
var hipCm = parseFloat(document.getElementById("hipCm").value);
var gender = document.getElementById("gender").value;
var resultDiv = document.getElementById("result");
// Input validation
if (isNaN(weightKg) || isNaN(heightCm) || isNaN(neckCm) || isNaN(waistCm) || weightKg <= 0 || heightCm <= 0 || neckCm <= 0 || waistCm <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all measurements.";
return;
}
if (gender === "female" && (hipCm <= 0 || isNaN(hipCm))) {
resultDiv.innerHTML = "Please enter a valid positive number for Hip Circumference for females.";
return;
}
var bodyFatPercentage = 0;
var circumferenceValue = 0; // This will be waist or (waist + hip) for women
if (gender === "male") {
// Navy Method for Males:
// Body Fat % = 495 / (1.0324 – 0.19077 * log10(waist + neck – height) + 0.15456 * log10(height)) – 450
circumferenceValue = waistCm + neckCm – heightCm;
if (circumferenceValue <= 0) { // Ensure the value inside log10 is positive
resultDiv.innerHTML = "Calculation error: Waist + Neck – Height must be positive.";
return;
}
bodyFatPercentage = 495 / (1.0324 – 0.19077 * Math.log10(circumferenceValue) + 0.15456 * Math.log10(heightCm)) – 450;
} else { // Female
// Navy Method for Females:
// Body Fat % = 495 / (1.29579 – 0.5501 * log10(waist + hip – neck) + 0.22126 * log10(height)) – 450
circumferenceValue = waistCm + hipCm – neckCm;
if (circumferenceValue <= 0) { // Ensure the value inside log10 is positive
resultDiv.innerHTML = "Calculation error: Waist + Hip – Neck must be positive.";
return;
}
bodyFatPercentage = 495 / (1.29579 – 0.5501 * Math.log10(circumferenceValue) + 0.22126 * Math.log10(heightCm)) – 450;
}
// Display the result, rounded to two decimal places
resultDiv.innerHTML = "Your Estimated Body Fat Percentage: " + bodyFatPercentage.toFixed(2) + "%";
}