Convert between feet and inches, add or subtract measurements.
Enter values and click a button
Understanding the Foot and Inch Calculator
This calculator helps you perform common operations with measurements given in feet and inches. Whether you need to add two lengths together, find the difference, or simply convert a measurement to a single unit (like total inches or a standardized feet and inches format), this tool simplifies the process.
How it Works: The Math Behind the Measurement
The core principle is converting all measurements into a common unit, usually inches, to perform arithmetic operations accurately.
Conversion to Inches: There are 12 inches in 1 foot. To convert a measurement from feet and inches to total inches, you multiply the feet by 12 and add the inches.
Total Inches = (Feet * 12) + Inches
Conversion from Total Inches: To convert a total number of inches back into feet and inches, you divide the total inches by 12. The whole number result is the feet, and the remainder is the inches.
Feet = Floor(Total Inches / 12) Inches = Total Inches % 12 (where '%' is the modulo operator, giving the remainder)
Addition: To add two measurements (e.g., Measurement A and Measurement B):
Convert Measurement A to total inches.
Convert Measurement B to total inches.
Add the two total inch values together.
Convert the resulting total inches back into feet and inches.
Subtraction: To subtract Measurement B from Measurement A:
Convert Measurement A to total inches.
Convert Measurement B to total inches.
Subtract the total inches of B from the total inches of A.
Convert the resulting total inches back into feet and inches. Handle negative results appropriately (though this calculator focuses on positive length measurements).
Use Cases:
This calculator is useful in various scenarios:
Home Improvement & DIY: Calculating the total length of materials needed for shelving, flooring, or construction projects.
Interior Design: Determining if furniture will fit by adding up dimensions or comparing spaces.
Gardening: Measuring planting distances or the height of plants.
Crafting & Sewing: Cutting fabric or assembling components that require precise length.
General Measurement Conversions: Quickly converting between feet and inches for everyday understanding.
Input your measurements in feet and inches, select the desired operation, and get your results instantly.
function getValues() {
var feet1 = parseFloat(document.getElementById("feet1").value);
var inches1 = parseFloat(document.getElementById("inches1").value);
var feet2 = parseFloat(document.getElementById("feet2").value);
var inches2 = parseFloat(document.getElementById("inches2").value);
// Handle invalid inputs by treating them as 0
if (isNaN(feet1)) feet1 = 0;
if (isNaN(inches1)) inches1 = 0;
if (isNaN(feet2)) feet2 = 0;
if (isNaN(inches2)) inches2 = 0;
// Ensure inches are within valid range (0-11) after parsing
inches1 = Math.max(0, Math.min(11, inches1));
inches2 = Math.max(0, Math.min(11, inches2));
return { feet1: feet1, inches1: inches1, feet2: feet2, inches2: inches2 };
}
function totalInches(feet, inches) {
if (isNaN(feet)) feet = 0;
if (isNaN(inches)) inches = 0;
// Ensure inches are within valid range (0-11)
inches = Math.max(0, Math.min(11, inches));
return (feet * 12) + inches;
}
function convertToInches() {
var values = getValues();
var total1 = totalInches(values.feet1, values.inches1);
var total2 = totalInches(values.feet2, values.inches2);
var resultDiv = document.getElementById("result");
resultDiv.textContent = "Total Inches: " + (total1 + total2).toFixed(2);
}
function convertToFeetInches() {
var values = getValues();
var total1 = totalInches(values.feet1, values.inches1);
var total2 = totalInches(values.feet2, values.inches2);
var grandTotalInches = total1 + total2;
var feet = Math.floor(grandTotalInches / 12);
var inches = grandTotalInches % 12;
var resultDiv = document.getElementById("result");
resultDiv.textContent = feet + " ft " + inches.toFixed(2) + " in";
}
function addMeasurements() {
var values = getValues();
var total1 = totalInches(values.feet1, values.inches1);
var total2 = totalInches(values.feet2, values.inches2);
var sumInches = total1 + total2;
var feet = Math.floor(sumInches / 12);
var inches = sumInches % 12;
var resultDiv = document.getElementById("result");
resultDiv.textContent = "Sum: " + feet + " ft " + inches.toFixed(2) + " in";
}
function subtractMeasurements() {
var values = getValues();
var total1 = totalInches(values.feet1, values.inches1);
var total2 = totalInches(values.feet2, values.inches2);
var differenceInches = total1 – total2;
var resultDiv = document.getElementById("result");
if (differenceInches < 0) {
resultDiv.textContent = "Result is negative. Cannot represent as positive length.";
} else {
var feet = Math.floor(differenceInches / 12);
var inches = differenceInches % 12;
resultDiv.textContent = "Difference: " + feet + " ft " + inches.toFixed(2) + " in";
}
}