Finance tools

COGS calculator (cost of goods sold)

Calculate cost of goods sold (COGS) for a month, quarter, or year — free, with no sign-up. Use beginning inventory, purchases, and ending inventory for one accounting period (periodic inventory), or enter revenue and gross margin % when you only have a P&L. Results update as you type: COGS, optional gross profit and COGS % of revenue, plus CSV or PDF export.

What is cost of goods sold (COGS)?

COGS formula

Periodic inventory method

What is goods available for sale?

Periodic vs perpetual inventory (what this calculator uses)

Two ways to calculate COGS in this calculator

From inventory

From revenue & margin

What's included in cost of goods sold?

Cost typeUsually COGS?Typical treatment
Merchandise / raw materialsYesInventory asset until sold; flows through COGS
Freight-in on stockOftenCapitalize to inventory or direct costs line
Store rent / warehouse leaseNoOperating expense (SG&A)
Sales commissionsNoOperating expense
Shop-floor wages (production)OftenDirect labor in COGS for manufacturers
Credit card processing on salesVariesMany SMBs book as operating expense — confirm with CPA

COGS on the income statement

LineExample
Revenue$100,000
− Cost of goods sold$60,000
= Gross profit$40,000
− Operating expenses(SG&A, etc.)
= Operating income

How to use this COGS calculator

  1. Align the accounting period

    Use beginning inventory at period start, purchases and direct costs during the period, and ending inventory at period end — monthly, quarterly, or annual.

  2. Gather inventory balances

    Pull beginning and ending inventory from the balance sheet and purchases for that same window.

  3. Enter your numbers

    Use From inventory for balance-sheet figures, or From revenue & margin if you only have sales and gross margin % from a P&L.

  4. Read COGS and export

    Review cost of goods sold, goods available for sale (in the breakdown), optional gross profit, and download CSV or PDF if needed.

Worked example (inventory method)

InputAmount
Beginning inventory$10,000
+ Purchases$25,000
+ Direct costs$2,000
= Goods available for sale$37,000
− Ending inventory$10,000
COGS$27,000

Common COGS examples by business type

Business typeTypical COGS componentsExample line items
Retail / ecommerceMerchandise at purchase costWholesale inventory, inbound freight, packaging tied to goods sold
Restaurant / food serviceFood and beverage ingredientsProduce, proteins, beverages — not front-of-house wages (often operating expense)
Light manufacturingMaterials + direct production laborRaw materials, shop-floor wages, factory utilities allocated to production
Reseller / distributorProduct cost from suppliersInventory purchases net of returns, import duties capitalized to stock

COGS percentage (COGS % of revenue)

COGS percentage formula

Industry (illustrative)COGS % of revenueNotes
Grocery / mass retailOften 60–75%High volume, thin net margins
RestaurantsOften 28–35% food costLabor and rent sit below gross profit
Apparel retailOften 50–65%Markdowns affect ending inventory and COGS
Software / digital goodsOften low COGS %Hosting and support may be OPEX, not COGS

When to use this COGS calculator vs margin tools

This COGS calculator

Profit margin & markup calculators

How to calculate COGS in Excel

CellLabel / formula
B1Beginning inventory
B2Purchases
B3Direct costs (optional)
B4Ending inventory
B5=B1+B2+B3 → Goods available for sale
B6=B5-B4 → COGS
B7Revenue (optional)
B8=B7-B6 → Gross profit
B9=B6/B7 → COGS % of revenue (format as %)

Discover more calculators for time tracking, payroll, and HR.

Frequently asked questions about Finance tools

How do I calculate cost of goods sold?

COGS = Beginning inventory + Purchases + Direct costs − Ending inventory for the same accounting period. Enter those figures in the calculator above, or use revenue and gross margin % if you only have a P&L.

What is the COGS formula?

COGS (cost of goods sold) is the cost of inventory you sold in the period. On the balance sheet: beginning inventory + purchases + direct costs − ending inventory. On the income statement: COGS = revenue − gross profit.

How do I calculate COGS from gross margin?

COGS = Revenue × (1 − Gross margin % ÷ 100). Example: $100,000 in sales at 40% gross margin → $60,000 COGS. Select From revenue & margin in this calculator.

What is a good COGS percentage?

COGS % = (COGS ÷ Revenue) × 100. There is no universal target — compare your trend and peers. Restaurants often aim for roughly 28–35% food cost; grocery retailers may run 60%+ COGS with thin net margins.

What are common COGS examples?

Common COGS includes merchandise you resell (retail), food ingredients (restaurants), raw materials and direct factory labor (manufacturing), and freight-in capitalized to inventory. Rent, marketing, and most office payroll are usually not COGS.

How do I calculate COGS in Excel?

In Excel, list beginning inventory, purchases, direct costs, and ending inventory. Compute goods available for sale, then COGS = goods available − ending inventory. Add revenue for gross profit; divide COGS by revenue for COGS %. See the formula table on this page or export from the calculator.

Where do I find cost of goods sold on an income statement?

COGS is usually the first expense line below revenue. Subtract it from revenue to get gross profit. If the report shows revenue and gross margin % only, use COGS = revenue − gross profit (From revenue & margin mode here).

What is included in cost of goods sold?

Included: direct materials, direct production or fulfillment labor (when applicable), and freight-in on inventory. Usually excluded: rent, marketing, admin payroll, and depreciation — those are typically operating expenses below gross profit.

Is cost of goods sold tax deductible?

COGS generally reduces taxable income for many US businesses because it is subtracted from revenue before gross profit. Treatment depends on entity type and accounting method — this tool is for planning, not tax advice. See IRS Publication 334 and your CPA.

Can COGS be negative?

Yes, but it is usually a data problem. Negative COGS often means ending inventory is higher than goods available for sale suggests — recheck counts and that all inputs use the same accounting period. This calculator flags negative COGS with a warning.

How do I calculate COGS for a service business?

Many service businesses have little inventory COGS. Billable labor may appear as cost of services instead. This calculator is built for goods inventory; ask your CPA how to map your accounts.

Does FIFO or LIFO change this calculator?

FIFO, LIFO, and average cost change how ending inventory is valued, which affects COGS when you close the period. Enter the inventory balances from your books — this tool does not apply a costing method for you.

How is COGS different from operating expenses?

COGS varies with units sold and sits above gross profit. Operating expenses (SG&A) cover running the business — rent, sales, and admin — and are subtracted after gross profit.

How does COGS relate to inventory days (DIO)?

Days inventory outstanding (DIO) uses COGS and average inventory for the same period. After you calculate COGS here, use our DIO calculator for turnover and days-on-hand metrics.