The COGS formula is: beginning inventory + purchases − ending inventory = cost of goods sold. It tells you how much it cost to produce or buy the products you actually sold in a period.
COGS (cost of goods sold) shows up on your income statement as an expense. You subtract it from net sales to get gross profit.
What Is COGS?
COGS is the direct cost of the goods a business sold during a specific reporting period. It is recorded as an expense on the income statement and is used to calculate gross profit.
Unsold inventory is different. It stays on the balance sheet as an asset until it is sold, used up, or written down. Only when a sale happens does that cost move into COGS.
You may also see it called cost of sales or cost of products sold. “Cost of revenue” is similar, but it can also include service-delivery or technology costs in businesses that don’t sell physical goods.
The COGS Formula
The standard periodic COGS formula is: beginning inventory + purchases − ending inventory.
COGS = Beginning Inventory + Purchases − Ending Inventory
A broader version adds other direct costs that belong in inventory:
COGS = Beginning Inventory + Purchases + Other Direct Costs − Ending Inventory
Manufacturers often think in terms of production costs instead: direct materials, direct labor, and manufacturing overhead flow into finished goods, and the cost of the finished goods that sell becomes COGS.
What Do the Formula Variables Mean?
Each variable is a dollar value of inventory or cost for the same accounting period.
- Beginning inventory: the value of inventory at the start of the period. It equals the prior period’s finalized ending inventory.
- Purchases: what you bought during the period to resell or make into products.
- Direct costs: other costs needed to get inventory ready to sell, such as freight-in or import duties.
- Ending inventory: the value of unsold goods at the end of the period, based on a physical count.
Use cost, not selling price, when valuing inventory. This is one of the most common mistakes.
How Does the COGS Formula Work?

It works by starting with everything you could have sold, then removing what you didn’t sell.
Beginning inventory plus purchases gives you the cost of goods available for sale. Ending inventory is what’s left on the shelf. Whatever remains must be the cost of the goods that sold.
COGS Formula Example
With $20,000 in beginning inventory, $50,000 in purchases, and $15,000 in ending inventory, COGS is $55,000.
| Step | Amount |
| Beginning inventory | $20,000 |
| + Purchases | $50,000 |
| = Goods available for sale | $70,000 |
| − Ending inventory | $15,000 |
| = COGS | $55,000 |
If net sales were $90,000, gross profit would be 35,000(90,000 − $55,000).
How Do You Calculate COGS?
Follow these steps and finish your physical inventory count first.
- Define the accounting period (month, quarter, or year).
- Confirm beginning inventory matches last period’s final ending inventory.
- Add up net purchases for the period.
- Add qualifying direct costs, such as freight-in.
- Count and value ending inventory at cost.
- Subtract ending inventory from the total.
Keep unit quantities and unit costs separate from total dollar values. That makes errors much easier to spot.
Net Purchases and Inventory Adjustments
Use net purchases, not the raw purchase total. Several items change the number:
- Purchase returns and allowances reduce purchases.
- Purchase discounts reduce purchases.
- Freight-in (inbound transport) is generally part of inventory cost.
- Import duties are also part of inventory cost.
Recoverable sales tax should not be included in inventory cost. Forgetting these adjustments is a quiet way to misstate COGS.
COGS Formulas by Business Type
The core idea stays the same, but the cost focus changes by business model.
| Business type | Calculation focus |
| Retailer | Beginning inventory + net purchases − ending inventory |
| Wholesaler | Beginning inventory + merchandise purchases − ending inventory |
| Manufacturer | Materials, labor, overhead, finished goods inventory |
| Restaurant | Food and beverage inventory consumed |
| E-commerce | Product cost plus applicable inbound and fulfillment costs |
| Service business | Direct labor and delivery costs, if treated as cost of revenue |
| SaaS | Hosting, infrastructure, and service-delivery costs, depending on policy |
| Construction | Direct project materials, labor, and allocable project costs |
Digital and service businesses increasingly use “cost of revenue” instead of traditional COGS. For e-commerce, decide in writing whether fulfillment and customer shipping count as COGS or operating expenses.
What Costs Are Included in COGS?
COGS includes costs needed to bring inventory to its present location and condition. This matches the wording in IFRS IAS 2.
Typical examples are product purchase cost, direct materials, direct production labor, manufacturing overhead, inbound freight, import duties, and product packaging.
What Costs Are Excluded from COGS?
General business costs that don’t tie directly to the products sold are excluded. These are operating expenses.
| Usually COGS | Usually operating expense |
| Direct materials | Advertising |
| Direct manufacturing labor | General administration |
| Production overhead | Office rent |
| Inbound freight | Corporate salaries |
| Import duties | Interest expense |
| Product packaging | Income tax |
| Costs bringing inventory to current condition | General legal and accounting costs |
Some items need a policy decision, such as outbound shipping, warehouse costs, software, and payment-processing fees. Pick a treatment, document it, and apply it consistently.
Direct Labor and Manufacturing Overhead
Only labor tied to making or delivering the product belongs in COGS. Factory workers who assemble goods count. Administrative, sales, and general support staff usually don’t.
Overhead works the same way. Factory utilities and equipment costs tied to production may be included. Head-office costs are not. Don’t record all employee wages as COGS.
Periodic Versus Perpetual COGS
A periodic system calculates COGS at period-end, while a perpetual system updates it with every transaction.
| Feature | Periodic | Perpetual |
| COGS timing | Period-end calculation | Updated after transactions |
| Inventory records | Less frequent updates | Continuous updates |
| Physical count | Important for period-end balance | Still needed for reconciliation |
| Typical use | Smaller or simpler operations | POS, e-commerce, and ERP environments |
| Main risk | Delayed visibility | System and integration errors |
Modern accounting and inventory software increasingly calculates COGS continuously. Even so, you should reconcile system numbers against a physical count.
Inventory Costing Methods
The method you pick decides which costs are assigned to sold goods and which stay in inventory.
| Method | Cost assigned to sales | Ending inventory |
| FIFO | Oldest costs first | Newer costs remain |
| LIFO | Newest costs first, where permitted | Older costs remain |
| Weighted average | Blended average cost | All units use an average cost |
| Specific identification | Actual cost of each item | Actual remaining item costs |
Under IFRS IAS 2, ordinarily interchangeable items use FIFO or weighted average. Specific identification applies to items that aren’t interchangeable or to specific projects. LIFO is not permitted under IFRS.
How Does FIFO Affect COGS?
FIFO assigns your oldest costs to sales first. When prices are rising, the older costs are lower, so COGS is lower and gross profit is higher.
Say you bought 10 units at $5, then 10 more at $7, and sold 10. Under FIFO, COGS is $50. Under weighted average, each unit costs $6, so COGS is $60. Same sales, different reported profit. Whichever method you choose, apply it consistently, and don’t switch just to improve your margin.
How Does COGS Affect Gross Profit?
Higher COGS lowers gross profit, and lower COGS raises it, assuming sales stay the same.
| Metric | Formula |
| Gross profit | Net sales − COGS |
| Gross margin | Gross profit ÷ net sales × 100 |
| COGS percentage | COGS ÷ net sales × 100 |
| Inventory turnover | COGS ÷ average inventory |
| Average inventory | (Beginning inventory + ending inventory) ÷ 2 |
| Markup percentage | Profit ÷ cost × 100 |
Gross margin and markup are not the same thing. Margin divides profit by sales, while markup divides profit by cost.
COGS Versus Operating Expenses
COGS covers direct product costs. Operating expenses support the business in general. Marketing, office rent, and corporate payroll are operating expenses.
Cost of revenue is a related term. It’s common for service, software, and digital businesses, and may include delivery and hosting costs.
How Does COGS Affect Taxes?
Higher COGS generally lowers taxable business income, all else equal. That’s why tax rules limit which costs and methods you can use.
Current IRS guidance in Publication 334 says businesses with inventory value it at the beginning and end of each tax year to figure COGS. U.S. sole proprietors use inventory information on Schedule C.
Tax rules and financial-reporting rules aren’t interchangeable. Check your jurisdiction’s current guidance and talk to a qualified accountant.
What Happens if Ending Inventory Is Wrong?
An error in ending inventory changes COGS and gross profit in the opposite direction.
| Error | Effect this period |
| Ending inventory overstated | COGS understated, gross profit overstated |
| Ending inventory understated | COGS overstated, gross profit understated |
| Beginning inventory overstated | COGS overstated, gross profit understated |
| Beginning inventory understated | COGS understated, gross profit overstated |
| Purchases omitted | COGS understated |
| Duplicate purchase entry | COGS overstated |
Because this period’s ending inventory becomes next period’s beginning inventory, one mistake can distort two periods.
Common COGS Calculation Mistakes
Most errors come from missing adjustments or mixing up cost and price.
- Adding ending inventory instead of subtracting it
- Using retail prices instead of acquisition cost
- Ignoring returns, allowances, and discounts
- Leaving out freight-in or import duties
- Including advertising, rent, or office costs
- Counting inventory twice
- Ignoring damaged, obsolete, or missing stock
- Confusing COGS with cash paid during the period
- Comparing ratios across industries without adjusting for business model
COGS Reconciliation Checklist
A short monthly check catches most problems early.
- Confirm beginning inventory equals last period’s final ending inventory.
- Use net purchases, not unadjusted totals.
- Complete the physical count before finalizing COGS.
- Reconcile the inventory subledger to the general ledger.
- Record approved write-downs for damaged or obsolete stock.
- Investigate unusually high or negative COGS right away.
How Can Businesses Reduce COGS?
Look at supplier prices, freight, shrinkage, and discounts first. Recalculate unit economics whenever supplier prices change.
Lower COGS is not always better. Cutting product quality to save money can hurt long-term profit. Track COGS as a percentage of net sales alongside inventory turnover and product mix.
Be careful with industry benchmarks. COGS ratios vary widely by industry, product, region, and accounting policy. Your own historical trend is usually more useful than a generic “healthy COGS” number.
COGS Calculator or Spreadsheet Formula
A simple calculator needs four inputs: beginning inventory, purchases, direct costs, and ending inventory.
In a spreadsheet, a formula like =B2+B3+B4-B5 does the job, with beginning inventory in B2, purchases in B3, direct costs in B4, and ending inventory in B5.
Add locked formulas, reconciliation checks, and version control. Most spreadsheet errors come from changed formulas or wrong inputs.
Conclusion
The COGS formula is simple: beginning inventory plus purchases minus ending inventory. The hard part is getting clean inputs, including net purchases, direct costs, and an accurate inventory count.
Pick a consistent inventory method, document your cost policies, and reconcile every period. Check current IRS or IFRS guidance for tax and reporting rules.
FAQs
What is the simplest COGS formula?
Beginning inventory + purchases − ending inventory. This gives the cost of the goods you sold in a period.
Does COGS include labor?
Only direct labor used to make or deliver the product. Administrative, sales, and general support labor are usually operating expenses.
Does COGS include shipping?
Inbound freight (freight-in) is usually part of inventory cost and later becomes COGS. Outbound shipping to customers may be COGS, fulfillment expense, or selling expense, depending on your policy.
Is COGS an expense?
Yes. COGS is recognized as an expense in the period the related goods are sold. Unsold inventory stays an asset.
What is a good COGS percentage?
It depends on your industry, product mix, and accounting policy. Compare against your own past periods and similar businesses instead of a universal target.
Why is my COGS negative?
Usually an error, such as an overstated ending inventory, a wrong beginning balance, or missing purchases. Investigate it right away.
What is the difference between COGS and cost of revenue?
They overlap, but cost of revenue can also include service-delivery or technology costs in businesses that don’t sell physical products