Cost of goods sold (COGS)
The direct cost of the products a company sold during a period
In briefCost of goods sold (COGS) is the direct cost of the products a company sold during a period. It is subtracted from net sales on the income statement to give gross profit. Only goods actually sold count; products still in stock stay on the balance sheet as inventory.
How is cost of goods sold calculated?
Under the periodic inventory method, OpenStax gives the calculation as:
COGS = beginning inventory + net purchases - ending inventory
Net purchases are gross purchases minus purchase discounts and purchase returns and allowances. Beginning inventory plus purchases is the goods available for sale, and whatever is not left at the end was sold. Under the perpetual method, the cost of each sale is recorded as it happens, so no year-end calculation is needed.
For a maker, the cost also includes materials and factory labor. Costs of selling and running the business, such as office rent, are not part of COGS. They appear lower on the income statement as operating expenses.
Cost of goods sold calculator
Change the numbers to see the result. Everything is calculated on this page; nothing is sent or saved.
- Cost of goods sold
- -
Illustration only, not financial, tax or investment advice.
A worked example
A shop starts the year with $40,000 of inventory. It buys $210,000 of goods and gets $10,000 back in returns and discounts. It ends the year with $50,000 of inventory. Its net sales are $300,000.
- Net purchases: $210,000 - $10,000 = $200,000
- Goods available for sale: $40,000 + $200,000 = $240,000
- COGS: $240,000 - $50,000 = $190,000
- Gross profit: $300,000 - $190,000 = $110,000
- Gross margin: $110,000 / $300,000 = about 36.7%
A real example: Costco
For the fiscal year that ended August 30, 2026, Costco reported net sales of $297.247 billion. Its income statement labels the line merchandise costs, and the amount was $264.279 billion.
- Net sales minus merchandise costs: $297.247 billion - $264.279 billion = $32.968 billion
- Merchandise costs as a share of net sales: about 88.9%
- Gross margin on net sales: about 11.1%
These are the figures used on the gross profit and gross margin pages. The inventory page uses the same merchandise costs to calculate turnover. Costco's filing says it values U.S. merchandise inventories on a last-in, first-out (LIFO) basis, so the method chosen for valuing inventory affects COGS. It also says merchandise costs include inbound and outbound shipping and the costs of its depots.
Why the inventory method matters
Because COGS depends on what inventory is valued at, the cost flow assumption changes the number. A company that sells identical items bought at different prices must decide which cost to assign to each sale. The first-in, first-out and last-in, first-out methods can give different COGS from the same purchases.
Common confusion
- Is COGS the same as all expenses? No. It covers the direct cost of products sold, not marketing, administration or interest.
- Is COGS the same as purchases? No. Purchases are what was bought in the period. COGS adjusts for inventory that was on hand at the start or end.
- Do service firms report COGS? Not always. A business that sells only services often has no goods to count.
- Is COGS always called COGS? No. Companies use cost of sales, cost of revenue or, at Costco, merchandise costs, and what each includes differs by company.
- Tax rules differ from the accounting treatment described here.
Related entries
- Gross profitWhat a company has left from sales after paying for the goods it sold
- Gross marginWhat is left from sales after paying for the goods sold
- Inventory turnoverHow many times a business sells through its stock in a period
- Income statementThe financial statement that shows revenue, costs and profit over a period
- CostcoWho owns it, how it merged with Price Club, and what a membership pays for
- Fixed vs. variable costsCosts that stay put as output changes, and costs that rise and fall with it