If you sell physical products, COGS is probably the most important number on your income statement that you're not paying enough attention to. It tells you what it actually cost to produce or buy the goods your customers purchased — and if you're getting it wrong, your profit numbers are fiction.
This cost of goods sold calculator takes the guesswork out. Enter your beginning inventory, what you purchased during the period, and your ending inventory. You'll instantly see your total COGS and gross profit margin — two numbers that directly shape your pricing, your taxes, and whether your business is actually making money or just moving money around.
Whether you're a retailer restocking shelves, an e-commerce seller managing warehouse inventory, or a manufacturer tracking raw materials, this tool gives you a clear picture of where your money goes before a single dollar hits your bottom line.
What Is Cost of Goods Sold?
Cost of goods sold — COGS for short — is the total direct cost of producing or purchasing every product you sold during a specific period. Think of it as the answer to: "Before rent, before salaries, before marketing — how much did the products themselves cost me?"
COGS captures raw materials, wholesale product costs, direct labor, and manufacturing overhead. It does not include your office lease, your marketing budget, or your sales team's commissions. Those are operating expenses — a separate line on your income statement entirely.
Here's why COGS matters so much: it's the first thing subtracted from your revenue to calculate gross profit. If your COGS is wrong, your gross profit is wrong, your margins are wrong, and every pricing and budgeting decision built on those numbers is wrong too. Getting this right isn't optional — it's the foundation your financial statements sit on.
The COGS Formula
The standard calculation is straightforward:
COGS = Beginning Inventory + Purchases − Ending Inventory
But each of those inputs has more to it than most people realize:
Beginning Inventory is the value of unsold stock at the start of your accounting period. If you're calculating COGS for Q2, it's whatever was on your shelves on April 1st. This number should match exactly to the ending inventory from your previous period. If it doesn't, something went wrong in your records — and your COGS will be off from the start.
Purchases is everything you bought or produced during the period to replenish inventory. This isn't just the invoice price from your suppliers. It includes freight-in costs to receive the goods, customs duties on imported products, and direct labor if you manufacture items yourself. A common mistake is expensing freight costs separately instead of rolling them into inventory — that understates your COGS and overstates your operating expenses.
Ending Inventory is what remains unsold at period's end. Getting this number right often requires a physical count, and the method you use to value that inventory (FIFO, LIFO, or weighted average) directly changes your COGS figure.
The underlying logic is intuitive: start with what you had, add what you bought, subtract what's left. The difference is what you sold.
Example: Start the quarter with $50,000 in inventory, purchase $200,000 in goods, and count $75,000 remaining at quarter's end. COGS = $50,000 + $200,000 − $75,000 = $175,000.
How to Use This Calculator
- Enter your Beginning Inventory — The dollar value of all inventory on hand at the start of the period. Pull this from your previous period's balance sheet or your last physical inventory count.
- Enter your Purchases — The total cost of all goods bought or produced during the period. Include supplier invoices, inbound freight, customs duties, and direct production labor.
- Enter your Ending Inventory — The dollar value of unsold inventory at period's end, based on your physical count or inventory management system.
- Read your results — The calculator shows your Cost of Goods Sold (total cost of goods that left your shelves) and your Gross Profit Margin (the percentage of revenue you keep after covering product costs).
Understanding Your Results
Cost of Goods Sold is the raw dollar amount your business spent on the products it sold. If your COGS is $175,000, that's money committed to materials, production, and procurement before you've paid for anything else.
Gross Profit Margin tells you how much breathing room you have. A 33% margin means you keep roughly 33 cents from every dollar of revenue after covering product costs. That remaining 33 cents has to cover rent, payroll, marketing, and everything else — then whatever's left is your actual profit.
What counts as a "good" margin depends entirely on your industry. A software company at 30% gross margin is in trouble. A grocery store at 30% is doing well. Here's how typical margins stack up:
Industry | Typical Gross Margin |
|---|---|
Software / SaaS | 70–85% |
Professional Services | 50–70% |
Retail (Apparel) | 45–65% |
Manufacturing | 30–45% |
Restaurants & Food Service | 30–40% |
Grocery & Food Retail | 25–35% |
Construction | 15–25% |
Auto Dealers | 10–15% |
If your margin sits well below your industry range, that's a clear signal to look at your supplier costs, pricing, or production efficiency.
What Belongs in COGS (and What Doesn't)
This is where most businesses make mistakes — not in the math, but in deciding which costs go into the formula. The IRS and accounting standards have clear guidelines, and getting the classification wrong distorts everything downstream.
Include in COGS:
- Raw materials and components
- Wholesale product costs (for resellers)
- Direct labor — wages for workers who physically make, assemble, or pack products
- Manufacturing overhead — factory rent, utilities, equipment depreciation
- Inbound freight and shipping to receive inventory
- Customs duties and import tariffs
- Packaging materials that ship with the product
Do NOT include in COGS:
- Marketing and advertising spend
- Sales team salaries and commissions
- Office rent (unless it's a production facility)
- Administrative salaries
- Outbound shipping to deliver orders to customers
- Research and development
- Interest on loans or financing
Here's the practical test: if a cost would exist even if you never sold a single product, it's almost certainly an operating expense, not COGS. Your office lease doesn't change whether you sell 100 units or 10,000. But the wood, hardware, and labor to build 10,000 tables? That's COGS.
One of the most common errors bookkeepers flag is businesses dumping all shipping costs into one bucket. Inbound freight (getting inventory from your supplier to your warehouse) belongs in COGS. Outbound shipping (delivering orders to customers) is a selling expense. Mixing them up makes your gross margin unreliable.
COGS by Business Type
The formula is the same everywhere, but what you're counting looks very different depending on your business:
Retail Clothing Boutique You open the month with $30,000 in inventory on the racks, receive $15,000 in new shipments from wholesalers, and count $20,000 remaining at month's end. COGS = $30,000 + $15,000 − $20,000 = $25,000. Your purchases include the wholesale price plus whatever you paid for freight to get the clothing to your store.
E-Commerce Seller Beginning of Q1: $8,000 in products at your fulfillment center. You order $45,000 in new inventory from overseas suppliers (including $3,200 in duties and inbound shipping). Quarter ends with $12,000 in remaining stock. COGS = $8,000 + $45,000 − $12,000 = $41,000.
Furniture Manufacturer Start the year with $120,000 in raw materials and finished goods. You spend $380,000 on lumber, hardware, and upholstery plus $120,000 on workshop labor and overhead. $95,000 in materials and finished pieces remain at year-end. COGS = $120,000 + $500,000 − $95,000 = $525,000.
Restaurant A café opens the week with $2,000 in food and beverage supplies, purchases $5,500 in ingredients from suppliers, and inventories $1,800 remaining at week's end. COGS = $2,000 + $5,500 − $1,800 = $5,700. Restaurants typically track food cost as a percentage of revenue — aim for 28–35% depending on your concept. If you're running above that, it's time to look at portion sizes, menu pricing, or supplier contracts.
Service Business Service companies don't typically use the traditional inventory-based formula. Instead, your "cost of services" or "cost of revenue" includes direct labor for client-facing work, tools and software used to deliver the service, and materials provided to clients. A web development agency's COGS might include developer salaries, hosting costs for client projects, and licensed software — but not office rent or the CEO's salary.
Inventory Valuation Methods and COGS
How you value your ending inventory changes your COGS — sometimes significantly. There are three standard approaches:
FIFO (First In, First Out) treats your oldest inventory as sold first. When prices are rising, FIFO produces a lower COGS and higher reported profit because you're expensing the older, cheaper stock. Most businesses use FIFO — it's intuitive and it's accepted worldwide.
LIFO (Last In, First Out) assumes your newest (and usually most expensive) inventory sells first. In inflationary periods, this produces a higher COGS and lower taxable income — which means you keep more cash. The trade-off: LIFO is only allowed under U.S. GAAP, and the IRS requires you to use the same method on your financial statements if you elect LIFO for taxes (the conformity rule under Section 472(c)).
Weighted Average Cost pools all units together at a blended cost per unit. It smooths out price swings and is often the simplest to manage, especially for businesses with high-volume, similar products.
Whichever method you pick, stay consistent. Switching requires IRS approval (Form 3115), and flipping between methods from year to year makes your period-over-period comparisons meaningless.
COGS and Your Tax Return
COGS isn't technically a tax "deduction" — it's subtracted from gross receipts to arrive at gross income, which happens before deductions even come into play. But the practical effect is the same: every dollar you can legitimately include in COGS reduces your taxable income.
A few IRS specifics worth knowing:
- Inventory purchases aren't immediately deductible. If you buy $50,000 in inventory and only sell $30,000 of it, your COGS is $30,000 — not $50,000. The remaining $20,000 sits on your balance sheet until those goods sell. This catches a lot of first-time business owners off guard at tax time.
- Year-end inventory counts directly affect your tax bill. Overcount your ending inventory and your COGS goes down — meaning higher taxable income and a bigger tax bill. Undercount it and you've underreported income, which is an audit risk.
- Businesses filing taxes report COGS on Form 1125-A (for corporations and partnerships) or Schedule C (sole proprietors). The form asks for your beginning inventory, purchases, labor, ending inventory, and your valuation method.
- The small business simplification: If your average annual gross receipts are $31 million or less (over the prior 3 years), you may qualify for simplified inventory accounting under Section 471(c). This can significantly reduce the bookkeeping burden around COGS.
How COGS Shapes Pricing and Cash Flow
COGS isn't just a number for your accountant — it has real operational consequences.
Pricing: If your per-unit COGS is $45, you know the absolute floor for your selling price. But COGS alone doesn't tell you the profitable price — you need enough margin above COGS to cover operating expenses, taxes, and your desired profit. Businesses that price based on "what competitors charge" without knowing their own COGS often discover they've been selling at a loss on certain product lines.
Cash flow: This is where COGS quietly creates problems. When you buy $100,000 in inventory, cash leaves your bank account immediately. But that cost doesn't appear on your income statement until those goods actually sell — which might be 30, 60, or 90 days later. For growing businesses, this gap is a cash flow trap. The faster you grow, the more cash gets tied up in unsold inventory, and plenty of profitable businesses have failed because they ran out of cash while waiting for inventory to convert to sales.
Tracking over time: If your COGS percentage is creeping upward while revenue holds steady, your margins are getting squeezed. Maybe supplier costs are rising, maybe you're carrying more dead stock, maybe production efficiency has slipped. Monthly COGS tracking catches these trends early — waiting until year-end to discover a margin problem means twelve months of lost profit.
Common COGS Mistakes to Avoid
After everything above, here are the mistakes that trip up real businesses:
- Recording inventory purchases as immediate expenses. Buying $20,000 of stock in November doesn't mean $20,000 in COGS for the year — only the portion that sold is COGS. The rest is an asset on your balance sheet.
- Mixing inbound and outbound shipping. Freight to receive goods from your supplier goes in COGS. Shipping orders to customers is an operating expense. Combining them into one "shipping" line gives you unreliable margins.
- Forgetting freight-in, duties, and tariffs. Every dollar you spend getting inventory to your door should be capitalized into inventory cost. Expensing it separately understates your COGS.
- Inconsistent inventory counts. If ending inventory this period doesn't match beginning inventory next period, every COGS calculation from that point forward is off.
- Never analyzing COGS by product line. A blended COGS hides the fact that one product might carry a 60% margin while another runs at a loss. Knowing your COGS per product (or per category) lets you focus on what's actually profitable.