function calculateQuiltBorders() {
var qWidth = parseFloat(document.getElementById('qWidth').value);
var qLength = parseFloat(document.getElementById('qLength').value);
var bWidth = parseFloat(document.getElementById('bWidth').value);
var fWidth = parseFloat(document.getElementById('fWidth').value);
if (isNaN(qWidth) || isNaN(qLength) || isNaN(bWidth) || qWidth <= 0 || qLength <= 0 || bWidth <= 0) {
alert("Please enter valid positive numbers for all dimensions.");
return;
}
// Calculation Logic: Straight Borders (Butted)
// 1. Two Side Borders (match the length of the quilt center)
var sideBordersLength = qLength * 2;
// 2. Two Top/Bottom Borders (match quilt width + 2x border width)
var topBottomBordersLength = (qWidth + (bWidth * 2)) * 2;
var totalLinearInchesNeeded = sideBordersLength + topBottomBordersLength;
// Calculate number of strips needed across the Width of Fabric (WOF)
var stripsNeeded = Math.ceil(totalLinearInchesNeeded / fWidth);
// Total fabric length (Inches) = strips * border width
// Adding 0.5 inch per strip for seam allowance and trimming is standard practice
var cutWidth = bWidth + 0.5;
var totalInchesFabric = stripsNeeded * cutWidth;
var yards = totalInchesFabric / 36;
var yardsRounded = Math.ceil(yards * 8) / 8; // Round up to nearest 1/8 yard
var finishedWidth = qWidth + (bWidth * 2);
var finishedLength = qLength + (bWidth * 2);
document.getElementById('totalStrips').innerHTML = "Total Strips to Cut: " + stripsNeeded + " strips (at " + cutWidth + "\" wide)";
document.getElementById('totalYardage').innerHTML = "Total Yardage: " + yards.toFixed(2) + " yards (Recommended purchase: " + yardsRounded.toFixed(3) + " yards)";
document.getElementById('finalSize').innerHTML = "Estimated Finished Quilt Size: " + finishedWidth + "\" x " + finishedLength + "\"";
document.getElementById('border-results').style.display = 'block';
}
Understanding Quilt Border Math
Adding a border to a quilt isn't just about making it bigger; it's about framing your hard work. This calculator helps you determine exactly how much fabric to buy so you don't run out halfway through cutting your strips. It uses the "straight-cut" or "butted" border method, which is the most common technique for beginner and intermediate quilters.
How the Calculation Works
To calculate the yardage for borders, we follow three primary steps:
Determine Linear Inches: We calculate the length of the two side borders (equal to the quilt length) and the two top/bottom borders (equal to the quilt width plus twice the border width).
Calculate Number of Strips: We divide the total linear inches by the usable Width of Fabric (WOF), which is typically 42 inches for standard quilting cotton.
Convert to Yardage: We multiply the number of strips by the cut width of the border (your desired width plus a 1/2 inch seam allowance) and divide by 36 to get the yardage.
Practical Example
If you have a quilt top that is 60″ x 80″ and you want a 5″ finished border:
Strips needed (at 42″ WOF): 300 / 42 = 7.14 (Round up to 8 strips)
Fabric required: 8 strips x 5.5″ = 44″ of fabric, which is approximately 1.25 yards.
Tips for Cutting and Sewing Borders
To prevent your quilt from "waving" or "ruffling," never simply sew a long strip to the side and cut off the excess. Instead, always measure your quilt center in three places (the edges and the middle) and take the average. Cut your border strips to that specific average length. Pin the center of the border to the center of the quilt, pin the ends, and then ease the fabric between the pins. This ensures your quilt stays square and flat.
Pro Tip: Most quilters prefer to round up to the nearest 1/8 or 1/4 yard to account for fabric shrinkage during pre-washing or slight errors in cutting.