Feet and Inches Calculator
Use this calculator to easily add or subtract measurements given in feet and inches. Whether you're working on a DIY project, calculating room dimensions, or just need to combine lengths, this tool simplifies the process.
Understanding Feet and Inches
The imperial system of measurement uses feet and inches to denote length or distance. One foot is equivalent to 12 inches. This system is commonly used in the United States for everyday measurements, construction, and personal height.
- Foot (ft): A unit of length equal to 12 inches.
- Inch (in): A unit of length, with 12 inches making up one foot. Inches can also be expressed in fractions (e.g., 1/2 inch, 1/4 inch) or decimals.
How to Add and Subtract Feet and Inches
Performing arithmetic with feet and inches requires a bit more care than with decimal numbers, due to the base-12 nature of inches within a foot.
Adding Measurements:
To add two measurements (e.g., 5 ft 8 in + 3 ft 7 in):
- Add the inches: 8 in + 7 in = 15 in.
- Convert excess inches to feet: Since 12 inches make a foot, 15 inches is 1 foot and 3 inches (15 – 12 = 3).
- Add the feet: 5 ft + 3 ft + 1 ft (from the inches conversion) = 9 ft.
- Combine: The total is 9 ft 3 in.
Subtracting Measurements:
To subtract two measurements (e.g., 7 ft 4 in – 2 ft 9 in):
- Check inches: You can't directly subtract 9 inches from 4 inches.
- Borrow from feet: Take 1 foot from the feet of the first measurement, converting it to 12 inches. Add these 12 inches to the existing inches: 7 ft becomes 6 ft, and 4 in becomes 4 + 12 = 16 in.
- Subtract the inches: 16 in – 9 in = 7 in.
- Subtract the feet: 6 ft – 2 ft = 4 ft.
- Combine: The result is 4 ft 7 in.
Our calculator automates these steps, handling conversions and borrowing/carrying for you.
Examples of Use
- Construction: If you need to cut two pieces of wood, one 6 ft 5 in and another 4 ft 10 in, and want to know their combined length, you'd add them.
- Interior Design: Calculating the total perimeter of a room for baseboards, where walls are measured in feet and inches.
- Personal Height: Determining the difference in height between two people.
.feet-inches-calculator-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f9f9f9;
padding: 25px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
max-width: 700px;
margin: 20px auto;
color: #333;
}
.feet-inches-calculator-container h2,
.feet-inches-calculator-container h3 {
color: #0056b3;
text-align: center;
margin-bottom: 20px;
}
.feet-inches-calculator-container p {
line-height: 1.6;
margin-bottom: 15px;
}
.feet-inches-calculator-container .calculator-form {
background-color: #ffffff;
padding: 20px;
border-radius: 8px;
border: 1px solid #e0e0e0;
margin-bottom: 25px;
}
.feet-inches-calculator-container .input-group {
display: flex;
align-items: center;
margin-bottom: 15px;
flex-wrap: wrap;
}
.feet-inches-calculator-container .input-group label {
flex: 0 0 120px;
margin-right: 10px;
font-weight: bold;
color: #555;
}
.feet-inches-calculator-container .input-group input[type="number"] {
flex: 1;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
max-width: 100px;
margin-right: 5px;
-moz-appearance: textfield; /* Firefox */
}
.feet-inches-calculator-container .input-group input[type="number"]::-webkit-outer-spin-button,
.feet-inches-calculator-container .input-group input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.feet-inches-calculator-container .input-group select {
flex: 1;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
max-width: 150px;
}
.feet-inches-calculator-container button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
font-size: 18px;
cursor: pointer;
transition: background-color 0.3s ease;
margin-top: 20px;
}
.feet-inches-calculator-container button:hover {
background-color: #0056b3;
}
.feet-inches-calculator-container .result-section {
margin-top: 25px;
padding-top: 15px;
border-top: 1px solid #eee;
text-align: center;
}
.feet-inches-calculator-container .calculator-result {
font-size: 24px;
font-weight: bold;
color: #28a745;
background-color: #e9f7ef;
padding: 15px;
border-radius: 8px;
margin-top: 15px;
word-wrap: break-word;
}
.feet-inches-calculator-container ul {
list-style-type: disc;
margin-left: 20px;
margin-bottom: 15px;
}
.feet-inches-calculator-container ol {
list-style-type: decimal;
margin-left: 20px;
margin-bottom: 15px;
}
.feet-inches-calculator-container li {
margin-bottom: 8px;
}
@media (max-width: 600px) {
.feet-inches-calculator-container .input-group {
flex-direction: column;
align-items: flex-start;
}
.feet-inches-calculator-container .input-group label {
margin-bottom: 5px;
flex: none;
}
.feet-inches-calculator-container .input-group input[type="number"],
.feet-inches-calculator-container .input-group select {
max-width: 100%;
width: 100%;
margin-right: 0;
margin-bottom: 10px;
}
}
function calculateFeetInches() {
var feet1 = parseFloat(document.getElementById('feet1').value);
var inches1 = parseFloat(document.getElementById('inches1').value);
var operation = document.getElementById('operation').value;
var feet2 = parseFloat(document.getElementById('feet2').value);
var inches2 = parseFloat(document.getElementById('inches2').value);
var resultDiv = document.getElementById('feetInchesResult');
// Validate inputs
if (isNaN(feet1) || isNaN(inches1) || isNaN(feet2) || isNaN(inches2)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
resultDiv.style.color = '#dc3545';
resultDiv.style.backgroundColor = '#f8d7da';
return;
}
// Ensure non-negative inputs for feet (inches can be 0)
if (feet1 < 0 || feet2 < 0) {
resultDiv.innerHTML = "Feet values cannot be negative.";
resultDiv.style.color = '#dc3545';
resultDiv.style.backgroundColor = '#f8d7da';
return;
}
if (inches1 < 0 || inches2 < 0) {
resultDiv.innerHTML = "Inches values cannot be negative.";
resultDiv.style.color = '#dc3545';
resultDiv.style.backgroundColor = '#f8d7da';
return;
}
// Convert all measurements to total inches
var totalInches1 = (feet1 * 12) + inches1;
var totalInches2 = (feet2 * 12) + inches2;
var resultInches;
if (operation === 'add') {
resultInches = totalInches1 + totalInches2;
} else if (operation === 'subtract') {
resultInches = totalInches1 – totalInches2;
} else {
resultDiv.innerHTML = "Invalid operation selected.";
resultDiv.style.color = '#dc3545';
resultDiv.style.backgroundColor = '#f8d7da';
return;
}
var sign = "";
if (resultInches < 0) {
sign = "-";
resultInches = Math.abs(resultInches);
}
// Convert total result inches back to feet and inches
var finalFeet = Math.floor(resultInches / 12);
var finalInches = resultInches % 12;
// Round inches to two decimal places for display if they are not whole numbers
finalInches = Math.round(finalInches * 100) / 100;
resultDiv.innerHTML = sign + finalFeet + " ft " + finalInches + " in";
resultDiv.style.color = '#28a745';
resultDiv.style.backgroundColor = '#e9f7ef';
}