About the COGS Calculator
This COGS calculator works out the cost of goods sold for a period using the periodic inventory method: what you had at the start, plus what you bought or made, minus what is still on the shelf at the end. Add your sales revenue and it also returns gross profit, gross margin and COGS as a share of revenue.
It is useful for retailers, e-commerce sellers, restaurants and small manufacturers preparing a monthly or year-end profit and loss statement, filling in a tax return, or checking whether rising supplier prices are eating into margins.
Include only costs directly tied to the products you sold — merchandise, raw materials, freight-in and direct production labor. General overhead such as office rent, marketing and administrative salaries belongs in operating expenses, not COGS.
With the default inputs, the cost of goods sold is $52,000.00. Change any value above to recalculate instantly.
How to use the cogs calculator
- 1Enter the value of inventory at the start of the period.
- 2Add net purchases and any other direct product costs.
- 3Enter the value of inventory counted at the end of the period.
- 4Optionally enter net sales to see gross profit and gross margin.
Formula and method
Under the periodic inventory method, the cost of goods available for sale is everything you started with plus everything you added during the period (purchases and direct costs such as freight-in and production labor). Whatever is not left in ending inventory must have been sold, so subtracting ending inventory gives COGS.
Gross profit is net sales minus COGS, and gross margin expresses it as a percentage of sales. Inventory should be valued consistently each period (FIFO, weighted average, or LIFO where allowed), because the valuation method changes the ending inventory figure and therefore COGS.
- Beginning inventory
- Value of stock on hand at the start of the period
- Purchases
- Net inventory bought or produced during the period
- Direct costs
- Freight-in, direct labor and other product costs
- Ending inventory
- Value of stock still on hand at the end of the period
Worked examples
Small retailer, one quarter
Goods available are $20,000 + $45,000 + $5,000 = $70,000. With $18,000 left at the end, COGS is $52,000. On $110,000 of sales, gross profit is $58,000 — a 52.73% gross margin.
Manufacturer, full year
Available goods total $580,000; subtracting $120,000 of ending inventory gives COGS of $460,000. Against $900,000 of revenue that leaves $440,000 gross profit, a 48.89% margin.
COGS only, no revenue entered
With $5,000 opening stock and $12,000 of purchases, $17,000 of goods were available. Ending with $6,500 on hand means $10,500 of inventory was sold. Margin outputs stay at zero until revenue is entered.
Frequently asked questions
What is included in cost of goods sold?+
COGS includes the direct cost of products sold: merchandise purchased for resale, raw materials, direct production labor, freight-in and manufacturing overhead tied to production. It excludes selling, marketing and general administrative costs.
Is COGS the same as operating expenses?+
No. COGS covers the direct cost of the goods you sold and sits above gross profit on the income statement. Operating expenses such as rent, marketing and office salaries are subtracted after gross profit to reach operating income.
Do service businesses have COGS?+
Pure service businesses often report “cost of services” or “cost of revenue” instead — for example contractor fees or hosting costs directly tied to delivering the service. If you hold no inventory, the inventory lines in this formula are simply zero.
How does inventory valuation affect COGS?+
FIFO, weighted-average and LIFO assign different costs to the units still on hand. When prices rise, FIFO leaves newer, costlier units in ending inventory and so reports lower COGS than LIFO. Use the same method consistently.
Where does COGS go on a tax return?+
US sole proprietors report it in Part III of Schedule C, and many businesses use IRS Form 1125-A. The same beginning inventory plus purchases minus ending inventory structure is used.
Results are estimates for educational purposes and are not financial advice. Rates, fees and terms vary — confirm with your lender or a licensed advisor before making decisions.