COGS Calculator for Ecommerce: Inventory Costs Without Guesswork
COGS is an inventory bridge; weak inventory records make precise-looking margins fiction.



Ecommerce COGS calculator
Cost of goods sold
$75000.00
$50000.00 gross profit · 40.0% gross margin on net sales.
This calculator runs in your browser and sends no inputs anywhere. Keep definitions, periods, allocation rules, and survey thresholds consistent when comparing results.
COGS equals beginning inventory plus net inventory purchases and acquisition costs, minus ending inventory, for the same period. It is an inventory-flow equation—not a list of every bill paid this month. A reliable ecommerce COGS calculator therefore depends on four disciplined inputs: opening stock, net purchases, ending stock, and a consistent costing policy.
Table of Contents
- How does the COGS calculator work?
- Which costs belong in inventory and COGS?
- Why do purchases and COGS differ?
- How do costing methods change the result?
- How should ecommerce teams reconcile COGS?
- What should you do after calculating COGS?
- Sources
- FAQ
How does the COGS calculator work?
A COGS calculator closes the inventory bridge for one defined period and then compares the resulting cost with net sales. The core COGS formula is:
Beginning inventory + net inventory purchases and acquisition costs − ending inventory = COGS
Use four clearly defined fields:
| Calculator field | What it represents | Sample value |
|---|---|---|
| Beginning inventory | Inventory value at the start of the period | $25,000 |
| Net purchases | Inventory purchases plus acquisition costs, after applicable returns and discounts | $80,000 |
| Ending inventory | Inventory still held at the end of the period | $30,000 |
| COGS | Cost assigned to inventory sold during the period | $75,000 |
The sample calculation is:
$25,000 + $80,000 − $30,000 = $75,000 COGS
If net sales are $125,000, gross profit is $50,000:
$125,000 − $75,000 = $50,000
Gross margin is 40.0%:
$50,000 ÷ $125,000 = 40.0%
The period must be consistent across all fields. Do not combine beginning inventory from one month, purchases from another period, or an ending inventory count taken on a different basis. The result is only as trustworthy as the inputs and the policy used to value them.
The calculation answers one specific question: how much inventory cost should be matched with the period’s net sales? It does not answer how much cash the business spent, how much advertising cost, or whether the business was profitable overall.
Which costs belong in inventory and COGS?
Inventory and COGS should include product acquisition costs and properly allocated inbound acquisition costs under the business’s costing policy. Selling, advertising, and general overhead should remain outside this inventory-flow calculation.
A practical way to think about landed product cost is the amount attached to obtaining inventory and bringing it into the inventory pool. If an inbound cost belongs with the product acquisition, include it consistently in net purchases and inventory valuation. SellerTrove’s landed cost calculator can help organize that pricing input before it reaches the COGS calculation.
Keep these categories separate:
- Inventory and COGS: product acquisition and properly allocated inbound costs.
- Net purchase adjustments: purchase-side returns and discounts handled under the chosen policy.
- Other operating costs: selling, advertising, and general overhead.
The separation matters because adding every payment to COGS makes product economics look worse than they are, while omitting acquisition costs makes gross profit look artificially high. The goal is not to place every cost in one bucket. The goal is to assign inventory costs consistently and compare them with the sales they support.
Returns and discounts also deserve deliberate treatment. If they affect the cost of inventory purchased, they should be reflected in net purchases rather than ignored or entered inconsistently from period to period.
Why do purchases and COGS differ?
Purchases and COGS differ because unsold purchases remain in ending inventory instead of becoming expense immediately. Purchases increase the inventory pool; COGS represents the portion assigned to inventory sold during the period.
That distinction explains why cash purchases are not automatically COGS. A business may pay for inventory this month but sell some of it later. The cash payment belongs to the purchasing event, while COGS follows the inventory flow for the reporting period.
The sample makes the bridge visible:
- Start with $25,000 of inventory.
- Add $80,000 of net purchases and acquisition costs.
- Subtract $30,000 still held at period end.
- Recognize $75,000 as COGS.
The $30,000 ending balance is not lost and is not current-period COGS. It remains attached to inventory until it is assigned to a later period’s sales.
This is why an ecommerce operator should resist calculating COGS from the purchasing account alone. A purchase report can show what entered the business, but it does not show what remained unsold. The ending inventory value completes the bridge.
How do costing methods change the result?
Costing methods can assign different dollar values to COGS while the physical inventory units remain unchanged. The important operating rule is to choose an appropriate policy and apply it consistently to beginning inventory, purchases, and ending inventory.
Possible policies include:
- FIFO
- LIFO where permitted
- Specific identification
- Weighted-average cost
The IRS Publication 538 and IRS Publication 551 provide reference points for inventory accounting concepts, but the operational lesson is straightforward: do not switch methods simply because another method produces a more attractive margin in one period.
A costing policy affects how the inventory pool is valued and therefore how much flows into COGS. If the policy changes without a clear process, month-to-month gross margin comparisons become difficult to interpret.
Document the chosen method in the calculator workflow. Make sure the team knows:
- Which inventory value starts the period.
- How net purchases are adjusted.
- How ending inventory is valued.
- Which costing method is applied.
- Where the final COGS figure is reconciled.
Consistency turns the calculator from a one-time estimate into a repeatable operating measure.
How should ecommerce teams reconcile COGS?
Ecommerce teams should reconcile COGS by tying system quantities, landed cost, adjustments, returns, and the general ledger before relying on the margin result. A short, repeatable review is more useful than a complicated model no one maintains.
Use this sequence:
- Define the period. Confirm the exact beginning and ending dates for inventory, purchases, and net sales.
- Tie beginning inventory. Confirm that the opening balance agrees with the prior period’s ending inventory.
- Build net purchases. Include product acquisition and properly allocated inbound acquisition costs, then reflect applicable returns and discounts.
- Confirm ending inventory. Use the inventory value still held at the end of the period, not the amount purchased during the period.
- Apply the same costing policy. Keep FIFO, LIFO where permitted, specific identification, or weighted-average treatment consistent.
- Compare with the general ledger. Investigate differences involving system quantities, landed cost, adjustments, returns, or account classification.
Only after those checks should you use COGS to judge gross profit or gross margin. The SEC financial statement basics resource is useful for keeping the distinction between financial statement measures clear.
The best COGS process is simple enough to repeat every reporting period and specific enough to explain every major difference. If the number cannot be traced back to inventory movement and the selected policy, it is not ready to drive pricing decisions.
What should you do after calculating COGS?
Use COGS as the starting point for pricing analysis, not the finish. Once the inventory bridge is verified, connect it with the other measures that determine whether a product or offer works economically.
A practical sequence is:
- Calculate and reconcile COGS.
- Compare COGS with net sales to determine gross profit and gross margin.
- Review variable economics with the SellerTrove contribution margin calculator.
- Validate product acquisition inputs with the landed cost calculator.
- Check price structure with the retail markup calculator.
- Use Stack Builder to continue evaluating the commercial setup.
For broader pricing work, continue through SellerTrove’s Pricing category. The important sequence is to keep the measures distinct: COGS explains inventory cost, gross profit explains sales less COGS, contribution margin adds relevant variable costs, and net profit reflects the broader business result.
Sources
FAQ
What is the COGS formula?
The COGS formula is: beginning inventory + net inventory purchases and acquisition costs − ending inventory = COGS. It measures the inventory cost assigned to sales for the same period.
Are inventory purchases the same as COGS?
No. Purchases add inventory to the pool, while COGS reflects the portion assigned to inventory sold. Unsold purchases remain in ending inventory.
Does shipping belong in COGS?
Shipping belongs in COGS only when it is a properly allocated inbound acquisition cost included under the landed-cost policy. Selling, advertising, and general overhead should not be added to inventory COGS.
What is the difference between COGS and contribution margin?
COGS measures inventory cost matched with sales. Contribution margin goes further by considering the variable costs associated with the sale, while net profit reflects the broader business result after additional expenses.
We track pricing and new tools across the whole catalog. Get an email when prices move or a better tool launches.