Fabric Yardage Calculator
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.calculator-container {
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 8px;
padding: 25px;
margin-bottom: 40px;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.calc-header {
text-align: center;
margin-bottom: 25px;
color: #2c3e50;
}
.input-group {
margin-bottom: 20px;
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.input-wrapper {
flex: 1;
min-width: 200px;
}
.input-wrapper label {
display: block;
margin-bottom: 8px;
font-weight: 600;
font-size: 0.9em;
color: #555;
}
.input-wrapper input, .input-wrapper select {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
box-sizing: border-box;
}
.btn-calculate {
display: block;
width: 100%;
padding: 12px;
background-color: #8e44ad;
color: white;
border: none;
border-radius: 4px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s;
margin-top: 10px;
}
.btn-calculate:hover {
background-color: #732d91;
}
#result {
margin-top: 25px;
padding: 20px;
background-color: #fff;
border: 1px solid #e0e0e0;
border-left: 5px solid #8e44ad;
border-radius: 4px;
display: none;
}
.result-row {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
border-bottom: 1px solid #eee;
padding-bottom: 10px;
}
.result-row:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}
.result-label {
color: #666;
}
.result-value {
font-weight: bold;
font-size: 1.1em;
color: #2c3e50;
}
.big-result {
font-size: 1.5em;
color: #8e44ad;
}
.article-content h2 {
color: #2c3e50;
margin-top: 30px;
border-bottom: 2px solid #eee;
padding-bottom: 10px;
}
.article-content p {
margin-bottom: 15px;
}
.article-content ul {
margin-bottom: 20px;
padding-left: 20px;
}
.article-content li {
margin-bottom: 8px;
}
.note {
font-size: 0.85em;
color: #666;
margin-top: 5px;
}
How to Calculate Fabric Yardage
Whether you are quilting, sewing curtains, or reupholstering furniture, accurately estimating fabric yardage is the first critical step in any project. Buying too little fabric leads to frustration, while buying too much can be costly waste. This guide explains the logic behind fabric estimation.
1. Determine Your Piece Dimensions
Start by measuring the finished size of the item you want to create. However, the raw cut size must be larger than the finished size to account for hems and joining seams. This is known as the seam allowance.
- Cut Length: Finished Length + (Seam Allowance × 2)
- Cut Width: Finished Width + (Seam Allowance × 2)
For example, if you need a finished pillow cover that is 18″ × 18″ and use a standard 1/2″ seam allowance, your cut dimensions for each piece will be 19″ × 19″.
2. Consider the Fabric Bolt Width
Fabric comes on bolts of varying widths. The "usable width" is slightly less than the total width due to the selvage edges (the tightly woven factory edges). Common widths include:
- 42-45 inches: Standard for quilting cotton and apparel fabrics.
- 54 inches: Common for home decor and upholstery.
- 60 inches: Frequently used for knits, fleece, and garment fabrics.
- 108 inches: Typically used for wide quilt backings.
3. The Calculation Logic
To calculate yardage manually, you must determine how many pieces fit across the width of the fabric (WOF). This is a division problem:
Pieces per Row = Floor(Fabric Width ÷ Cut Width)
If your fabric is 44″ wide and your piece is 19″ wide, you can fit 2 pieces side-by-side (19 + 19 = 38″). You cannot fit a third piece.
Next, calculate how many rows of cuts you need:
Total Rows = Ceiling(Total Quantity ÷ Pieces per Row)
Finally, multiply the number of rows by the length of the piece to get the total length in inches, and divide by 36 to convert to yards.
4. Directional Prints vs. Non-Directional
The calculation above assumes the fabric has no specific direction (you can rotate pieces to fit better). If your fabric has a directional print (like trees standing up), you cannot rotate pieces 90 degrees to squeeze them onto the fabric. You must align the "grain" of your piece with the length of the fabric bolt. Always buy 10-20% extra fabric to account for shrinkage during pre-washing or mistakes in cutting.
5. Converting Inches to Yards
Fabric is sold by the yard in the US and UK (or meters elsewhere). One yard equals 36 inches.
- 1/4 yard = 9 inches
- 1/2 yard = 18 inches
- 3/4 yard = 27 inches
- 1 yard = 36 inches
When in doubt, always round up to the nearest 1/4 or 1/2 yard to ensure you have enough material.
function calculateYardage() {
// 1. Get Input Values
var pLength = parseFloat(document.getElementById('pieceLength').value);
var pWidth = parseFloat(document.getElementById('pieceWidth').value);
var qty = parseInt(document.getElementById('quantity').value);
var fabWidth = parseFloat(document.getElementById('fabricWidth').value);
var price = parseFloat(document.getElementById('pricePerYard').value);
var seam = parseFloat(document.getElementById('seamAllowance').value);
// 2. Validation
if (!pLength || !pWidth || !qty || !fabWidth) {
alert("Please enter valid dimensions and quantity.");
return;
}
if (isNaN(seam)) seam = 0;
if (isNaN(price)) price = 0;
// 3. Adjust for Seam Allowance (add to both sides)
var cutLength = pLength + (seam * 2);
var cutWidth = pWidth + (seam * 2);
// 4. Calculation Logic: Compare Orientation Efficiency
// We calculate two scenarios: Standard Grain and Rotated (Cross Grain)
// Scenario A: Width of piece fits along Width of Fabric
var piecesPerRowA = Math.floor(fabWidth / cutWidth);
var totalRowsA = 0;
var totalInchesA = Infinity; // Default to infinity if impossible
if (piecesPerRowA > 0) {
totalRowsA = Math.ceil(qty / piecesPerRowA);
totalInchesA = totalRowsA * cutLength;
}
// Scenario B: Length of piece fits along Width of Fabric (Rotated 90 deg)
// Note: This is efficient for non-directional fabric
var piecesPerRowB = Math.floor(fabWidth / cutLength);
var totalRowsB = 0;
var totalInchesB = Infinity;
if (piecesPerRowB > 0) {
totalRowsB = Math.ceil(qty / piecesPerRowB);
totalInchesB = totalRowsB * cutWidth; // The 'height' of the row is now the cutWidth
}
// 5. Determine Winner
var finalInches = 0;
var methodUsed = "";
var wasteWarning = "";
// Check if item is too big for fabric in any direction
if (piecesPerRowA === 0 && piecesPerRowB === 0) {
document.getElementById('result').style.display = 'block';
document.getElementById('result').innerHTML = "Error: The piece is larger than the fabric width in both directions. You will need to seam pieces together or find wider fabric.";
return;
}
// Simple logic: Pick the one that uses less length (default to A if equal or B impossible)
if (totalInchesA <= totalInchesB) {
finalInches = totalInchesA;
methodUsed = "Standard Layout (Grain aligned with Length)";
} else {
finalInches = totalInchesB;
methodUsed = "Rotated Layout (Grain aligned with Width)";
}
// 6. Convert to Yards
var totalYards = finalInches / 36;
// Round up to 2 decimal places for display, but keep raw for math
var displayYards = totalYards.toFixed(2);
// Calculate rounded buying recommendation (usually nearest 1/8 or 1/4)
// Let's recommend nearest 1/4 yard upwards
var yardsRecommended = Math.ceil(totalYards * 4) / 4;
// Calculate Cost
var totalCost = yardsRecommended * price;
// 7. Output HTML
var resultHTML = '
Exact Yardage Needed:' + displayYards + ' yds (' + finalInches + '")
';
resultHTML += '
Buy This Amount:' + yardsRecommended.toFixed(2) + ' yds
';
if (price > 0) {
resultHTML += '
Estimated Cost:$' + totalCost.toFixed(2) + '
';
}
resultHTML += '
Layout Strategy:' + methodUsed + '
';
resultHTML += '
Note: Includes ' + seam + '" seam allowance on all sides. Recommendation rounded up to nearest 1/4 yard.';
document.getElementById('result').innerHTML = resultHTML;
document.getElementById('result').style.display = 'block';
}