How to Calculate Cost of Goods Sold (COGS)
Calculate COGS from beginning inventory, purchases, and ending inventory, then use it to find gross profit and margin.

Cost of goods sold is the direct cost of the products sold during a period. Use
COGS = beginning inventory + purchases − ending inventory. It includes product costs such as materials, merchandise, packaging, and direct labor, but excludes overhead such as marketing and rent.
Use the margin calculator after you know COGS and revenue to find gross profit margin.
What COGS measures
COGS measures the cost tied to sold products, not every business expense. That makes it the cost number used to calculate gross profit.
Inventory timing matters. Products still sitting on the shelf are not COGS yet. Ending inventory is subtracted because those costs remain in stock rather than moving into the period's sold-goods cost.
Step-by-step COGS example
Suppose a small bakery starts the month with ingredients and packaging on hand, buys more during the month, and counts what is left at the end.
That means eight hundred dollars of direct product cost flowed into the goods sold during the month.
What belongs in COGS
COGS includes direct costs that become part of the product or are required to produce it. The exact list depends on the business model.
COGS excludes costs that support the business but do not become part of the product sold.
COGS, gross profit, and margin
Once COGS is known, gross profit is revenue minus COGS. Gross margin turns that profit into a percentage of revenue.
This is why COGS matters for pricing. If direct costs rise and price stays fixed, gross margin shrinks.
Common mistakes
Counting all expenses as COGS overstates product cost. Rent, advertising, and admin software belong elsewhere unless they are directly tied to producing the goods sold.
Forgetting ending inventory overstates COGS. Unsold stock still has value and should stay in inventory.
Using purchases alone misses beginning stock. If you sold goods from inventory you already had, those costs belong in COGS for the period.
Common questions
The formula is COGS = beginning inventory + purchases − ending inventory. It calculates the direct cost of goods sold during the period.
Direct labor used to make the product can be included. General admin labor, sales labor, and owner draws are not usually COGS.
No. COGS is one type of expense tied directly to goods sold. Operating expenses such as rent, marketing, and software are separate.
Gross profit equals revenue minus COGS. Higher COGS lowers gross profit and gross margin unless revenue rises too.
COGS is the direct cost bridge between inventory and gross profit. Count what was available, subtract what remains, then use the margin calculator to see how the cost affects margin.


