By Stockria Team

What is cost of goods sold?

Cost of goods sold (COGS) is the direct cost of producing or purchasing the products you sold during a specific period. It includes the cost of materials, direct labor for production, and any other costs directly tied to making or buying the products.

COGS does not include indirect costs like rent, marketing, office salaries, or utilities (unless they are directly tied to production). Those are operating expenses, not COGS.

Why does COGS matter? It is the foundation of your gross profit calculation. Revenue minus COGS equals gross profit. If your COGS is wrong, your gross profit is wrong, your margins are wrong, and your pricing decisions are based on bad data.

The COGS formula

Inventory management

COGS = Beginning Inventory + Purchases - Ending Inventory

Beginning inventory is the value of all unsold products at the start of the period.

Purchases is the total cost of new inventory bought or produced during the period. For manufacturers, this includes raw materials, direct labor, and manufacturing overhead (also known as cost of goods manufactured).

Ending inventory is the value of unsold products at the end of the period.

The logic is simple: you started with some inventory, added more, and ended with some. Whatever is not there anymore was sold. The cost of that sold inventory is COGS.

Examples by business type

Retail example. A boutique clothing store starts January with $40,000 in inventory. During January, they purchase $15,000 in new stock from wholesalers. At the end of January, they have $38,000 in inventory. COGS = $40,000 + $15,000 - $38,000 = $17,000. If January revenue was $35,000, gross profit is $18,000 (51% margin).

Ecommerce example. An online seller of phone accessories starts Q4 with $12,000 in inventory. They purchase $25,000 in products from their supplier. Ending inventory is $9,000. COGS = $12,000 + $25,000 - $9,000 = $28,000.

Manufacturing example. A soap maker starts the month with $5,000 in finished goods. Cost of goods manufactured during the month is $8,000 (raw materials, direct labor, overhead). Ending finished goods inventory is $4,500. COGS = $5,000 + $8,000 - $4,500 = $8,500.

Choosing an inventory costing method

Stockria in action — Manage your entire product catalog with stock levels, pricing, and reorder points. Stockria in action — Manage your entire product catalog with stock levels, pricing, and reorder points.

The COGS formula is straightforward, but calculating inventory value depends on which costing method you use. The three most common are:

FIFO (First In, First Out). Assume the oldest inventory is sold first. During periods of rising prices, FIFO results in lower COGS and higher gross profit.

LIFO (Last In, First Out). Assume the newest inventory is sold first. LIFO results in higher COGS during inflation, which lowers taxable income. Not allowed under IFRS (international standards).

Weighted average. Calculate the average cost of all units available for sale and apply it to both COGS and ending inventory. Simplest to calculate for businesses with many similar items.

For most small businesses, FIFO or weighted average is the practical choice. Pick one and use it consistently.

Common mistakes

Including operating expenses. Rent for your retail store is not COGS. Rent for your production facility is. The distinction is whether the cost directly relates to making or buying the products you sell.

Ignoring freight-in costs. Shipping costs to get products to your warehouse should be included in the purchase cost of inventory and therefore in COGS. Shipping to customers is a selling expense.

Inconsistent counting. If your ending inventory count is inaccurate, COGS will be wrong. An overcount understates COGS and inflates profit. An undercount does the opposite.

Multi-location inventory tracking
Barcode scanning from your phone
Low-stock alerts and reorder points
Purchase orders in two clicks
Works alongside your accounting tool

Track COGS monthly

Calculate COGS monthly, not just at year-end. Monthly tracking reveals trends — rising supplier costs, shifting product mix, or shrinkage problems — while you still have time to act on them. Your inventory management system should make this calculation simple by tracking purchases, inventory values, and product costs continuously.