
How it works
COGS counts only the products that were actually sold in the period, not everything bought. The usual formula is:
COGS = opening stock + purchases during the period − closing stock
Opening stock is the value of unsold goods at the start. Purchases are what you bought or made. Closing stock is the value of what is still unsold at the end. Whatever "left the shelf" is the cost of goods sold.
What goes into the cost depends on the business. For a store it is usually the price paid to the supplier, inbound freight and import duties. For a business that makes its own goods it also includes materials and production labor. For a digital product with no stock, the equivalent is often called cost of revenue: hosting, licences and per-sale fees.
Example
An online store starts the year with $30,000 of stock and buys $110,000 more during the year. At year end, $40,000 is unsold.
COGS = $30,000 + $110,000 − $40,000 = $100,000.
If the store's revenue was $220,000, gross profit is $220,000 − $100,000 = $120,000, and gross margin is about 55%.
COGS in an online store vs a software business
What counts as a direct cost changes with the business model.
| Cost | Online store | SaaS or app |
|---|---|---|
| Product purchase or materials | In COGS | Not applicable |
| Inbound freight and duties | In COGS | Not applicable |
| Payment processing fees | Often COGS or a selling cost, be consistent | Often cost of revenue |
| Hosting and servers | Usually an overhead | Usually cost of revenue |
| Third-party APIs charged per use | Not applicable | Cost of revenue |
| Customer support staff | Overhead | Often cost of revenue, depending on the books |
| Advertising | Not COGS | Not COGS |
Because the classification varies, buyers often ignore the label and recompute margin from the bills.
Recomputing gross margin from the bills
A seller reports $220,000 of revenue and $100,000 of COGS, a 54.5% margin. A buyer finds $9,000 of freight and $4,400 of payment fees recorded as overheads:
COGS = $100,000 + $9,000 + $4,400 = $113,400 Gross profit = $220,000 − $113,400 = $106,600 Gross margin = $106,600 ÷ $220,000 = about 48.5%
The business looks about six points weaker, and every point of margin feeds the profit a buyer multiplies. The figures are made up.
Why it matters in a valuation
Buyers of ecommerce businesses use COGS to see what each sale really earns. They look for:
- Stock counted correctly. An overstated closing stock lowers COGS and inflates profit.
- Consistent costs. Supplier prices, freight and duties can change quickly. Buyers compare the last 12 months with earlier periods.
- Complete costs. Leaving freight or fees out of COGS makes the margin look better than it is.
- Stock that will not sell. Old stock still sitting in closing stock may be worth less than its recorded cost.
Because COGS feeds net profit, a small error here moves the profit a buyer multiplies by a multiple. Ask your accountant how COGS should be recorded for tax in your country, as the rules differ.
Frequently asked questions
Is COGS the same as operating expenses?
No. COGS is the direct cost of the goods sold. Operating expenses are overheads such as advertising, salaries and software that exist whether or not a sale happens.
Does COGS include shipping to customers?
It depends on the books. Inbound freight to get stock to you is usually COGS. Shipping to customers is often treated as a selling cost, but it should be treated the same way each period. Ask your accountant.
How is COGS different from cost of revenue?
Cost of revenue is the broader term often used for software and services, where there is no stock. Hosting, licenses and per-sale fees sit there.