How do I calculate cost of goods sold for my e-commerce store?
The formula is straightforward: Beginning Inventory + Purchases - Ending Inventory = Cost of Goods Sold. The tricky part for e-commerce sellers is knowing exactly what costs belong in that calculation.
Product cost is the obvious component. What you paid your supplier for the goods you sell. But COGS should also include costs directly tied to getting inventory ready for sale. Inbound freight and shipping to your warehouse or fulfillment center counts. If you import products, include customs duties and tariffs. Packaging materials that you purchase separately to prepare items for sale also belong here.
What doesn’t belong in COGS is where most sellers get confused. Outbound shipping to customers is an operating expense, not a product cost. Amazon referral fees, Shopify payment processing fees, and advertising spend are all operating expenses. FBA storage fees go to operating expenses too. Mixing these into COGS throws off your gross margin and makes it impossible to see which products actually make money.
You also need to pick an inventory costing method. Most e-commerce businesses use either FIFO (First In, First Out) or weighted average cost. FIFO assumes you sell your oldest inventory first, which matters when product costs change over time. Average cost takes your total inventory value and divides by units on hand. Both are acceptable for tax purposes. Pick one and stay consistent.
The formula only works when you know your accurate inventory value at the start and end of each period. If you’re not doing regular inventory counts or your system doesn’t track costs properly, your COGS calculation will be off. This is where many sellers run into problems. They look at their profit margins and something doesn’t add up, but they can’t pinpoint why.
Accurate COGS directly affects your gross profit margin, which tells you whether your pricing works. Understated COGS makes you think you’re making more per sale than you actually are. Overstated COGS leads to incorrect inventory valuation on your balance sheet and can cause issues at tax time.
If your current numbers don’t match reality, inventory accounting setup might be the issue rather than the formula itself. Getting the tracking right from the start saves hours of cleanup later and gives you margins you can actually trust for pricing and purchasing decisions.
Full-Service Bookkeeping for Greater Phoenix
The Next Step:
A Quick Conversation
Tell us about your situation. We'll listen, ask a few questions, and give you a clear price to handle the work.
More Questions
Do I need FIFO or LIFO for my retail inventory?
For most retail businesses, FIFO is the better choice. It matches how inventory actually moves through your store and keeps your balance sheet accurate. LIFO creates complexity that rarely benefits smaller retail operations.
Read answerHow do I account for Shopify payouts and transaction fees?
Record your gross sales as revenue and Shopify fees as a separate expense. Don't just book the net payout amount to income or you'll underreport revenue and miss tracking what you're actually paying in fees.
Read answerHow do I handle multi-channel sales bookkeeping for Amazon and Shopify?
Track gross sales, fees, and refunds separately for each channel rather than recording net deposits as revenue. Integration tools like A2X pull settlement data from Amazon and Shopify to create accurate journal entries in your accounting software.
Read answerWhat's the best way to handle dropshipping bookkeeping?
Track cost of goods sold without holding inventory by matching each supplier payment to its corresponding sale. Automate platform fee tracking and sales imports to handle high transaction volume and maintain visibility into actual margins.
Read answerWhat accounting software works best for retail stores?
The best accounting software for retail depends on your inventory complexity and POS system. QuickBooks Online and Xero both work well for most retail stores, but the right choice depends on what integrations you need and how many products you carry.
Read answerHow do I handle currency conversion for international e-commerce sales?
Most platforms convert foreign currency to USD before paying you, so your books stay in dollars. Track the conversion fees separately, reconcile payouts to your bank, and record revenue at the amount you actually received.
Read answer