back arrow
back to all BLOG POSTS

How to Calculate Gross Margin: how to calculate gross margin for profitability

How to Calculate Gross Margin: how to calculate gross margin for profitability

Forget revenue. Forget conversion rates. If you want to know if your eCommerce business is actually profitable, you need to know your gross margin. This is the single most important number for understanding the core health of your product sales.

It all boils down to a pretty simple formula: (Revenue - Cost of Goods Sold) / Revenue. That one calculation tells you exactly what percentage of your sales is left over after you've paid for the products themselves.

Why Gross Margin Is Your True North Metric

So many store owners get fixated on top-line revenue, but high sales numbers can easily mask an unhealthy business. I've seen it time and time again: a brand is doing millions in sales but is barely breaking even—or worse, losing money on every order.

Gross margin cuts through the noise. It’s the metric that tells you if your business model is fundamentally sound and scalable. It's not just some accounting term; it’s the key that unlocks smarter decisions on everything from your pricing strategy to your ad spend.

A solid grasp of your gross margin helps you answer the questions that really matter:

  • Is this product actually making money? A bestseller isn't a winner if the margin is razor-thin.
  • Can we afford to run this sale? Knowing your margin helps you set discount limits that don't gut your profits.
  • How much can we really spend on ads? A healthy margin gives you the fuel and flexibility to acquire new customers profitably.

The Core Formula Explained

At its heart, calculating gross margin is straightforward. You take the total money you made from selling a product, subtract all the direct costs of getting that product ready to sell, and then divide that profit by your initial revenue. To turn it into the percentage we all use, just multiply by 100.

The Gross Margin Formula:
(Total Revenue − Cost of Goods Sold) / Total Revenue × 100%

Let’s quickly break down those two main ingredients:

  1. Total Revenue: This is simple—it's the total cash you brought in from sales before any other costs are taken out. If you sell 100 widgets at $50 a pop, your total revenue is $5,000.
  2. Cost of Goods Sold (COGS): This is where people sometimes trip up. COGS isn't just what you paid your supplier. It includes all the direct costs to get the product into your customers' hands, like inbound shipping, customs duties, and even the cost of your branded packaging.

Margin in the Real World

This isn't just a number for your spreadsheet; it dictates how you compete. The calculation is simple—(Revenue - COGS) / Revenue × 100—but its impact is massive. Just look at different industries: specialty retail often enjoys a healthy average gross margin of 36.5%, while a capital-intensive sector like the steel industry runs on a much tighter 13.7%. You can dig into more of these industry benchmarks over on FullRatio.com.

For a Shopify store owner, a higher gross margin means more cash to pour back into the business. This is the money that fuels growth. It pays for your marketing campaigns, covers salaries, and eventually becomes your net profit. Flying blind without a firm handle on this number is one of the fastest ways to run a business into the ground.

Calculating Your True Cost of Goods Sold

To really get a handle on your business's health, you have to nail your Cost of Goods Sold (COGS). It's the single most important—and easily messed up—part of the gross margin formula. Too many founders make the simple mistake of thinking COGS is just what they paid their supplier. That's a huge oversimplification that leads to a dangerously rosy view of profitability and, down the road, some really bad pricing decisions.

Your true COGS is the sum of every single direct cost you pay to get your products ready to sell. It isn't just the factory price. It's the full story of your inventory's journey, from the manufacturer all the way to your warehouse shelves. Miss even a few small expenses here, and every single profitability metric you look at will be off.

This simple diagram shows how Revenue and COGS are the two core ingredients for figuring out your Gross Margin.

A process flow diagram illustrating the calculation of gross margin: Revenue minus COGS equals Gross Margin.

As you can see, gross margin isn't just some arbitrary number. It’s the direct result of what you bring in versus what you spend to get your products in the first place.

The Complete COGS Checklist

The best way to think about your COGS is as a "landed cost." This means tallying up every fee you pay until that product is sitting in your fulfillment center, ready to be picked, packed, and shipped. Knowing how to calculate Cost of Goods Sold (COGS) accurately is the foundation for everything that follows.

Here’s a non-negotiable checklist of costs you have to include:

  • Product Purchase Price: This is your starting point—the direct per-unit cost from your supplier or manufacturer.
  • Inbound Shipping & Freight: The cost to get your inventory from the factory to your warehouse or third-party logistics (3PL) partner.
  • Customs & Duties: Any taxes and tariffs you pay on imported goods. These can be surprisingly high and vary a ton based on product type and where it's coming from.
  • Transaction Fees: Those percentage-based fees that payment processors like Shopify Payments, PayPal, or Stripe take on every single sale.
  • Packaging Materials: The cost of your mailer boxes, product inserts, tape, and any other branded materials you use to ship an order.
  • Product Prep & Labeling: Any extra costs for getting products ready for fulfillment, like applying barcodes or creating product bundles.

Ignoring these things adds up faster than you'd think. A 2-3% transaction fee or $0.50 for a custom mailer box might seem minor on its own. But multiply that across thousands of orders, and you'll see your margins get eaten away.

A Real-World Shopify Example

Let's break this down. Imagine you sell a fancy ceramic mug on your Shopify store. At first glance, the COGS seems simple. But let’s dig in.

  • Supplier Price: You buy the mug for $8.00.
  • Inbound Freight: Shipping a pallet of mugs to your warehouse averages out to $1.50 per unit.
  • Customs Duties: Tack on another $0.75 per mug in import fees.
  • Custom Box: Your beautiful, branded packaging costs $1.25 a pop.
  • Payment Processing: On a $40 retail price, Shopify Payments takes a $1.19 fee (at 2.7% + 30¢).

Suddenly, that "simple" $8.00 product cost is actually $12.69 once you add up all the direct expenses.

By ignoring just a few dollars in related costs, your perceived gross margin of 80% is actually a much more realistic 68%. That gap is the difference between a scalable business and one that’s secretly running on fumes.

Keeping track of these costs properly demands good bookkeeping and a solid inventory management system. For a deeper dive, check out our guide on https://www.ecorn.agency/blog/small-business-inventory-management. This isn't just about accounting; it's a strategic must-have for making smart calls on pricing, promotions, and your entire growth plan.

Putting the Gross Margin Formula into Practice

Knowing the formula is one thing, but the real magic happens when you start applying it to your own sales data. This is where you move from theory to reality and get a crystal-clear picture of your store's financial health.

Let's dig into a couple of real-world scenarios that every eCommerce operator runs into. It's easy enough to calculate margin on a single T-shirt, but what about when you're selling product bundles or juggling a catalog with dozens of different SKUs? Your overall profitability is a blend of all those individual margins, and you need to know how they all add up.

A diagram illustrating bundle margin calculation with revenue and COGS, resulting in an 80% margin.

Calculating Margin for a Product Bundle

Product bundles are a brilliant way to bump up your average order value, but they do make the math a little trickier. You can't just look at the cost of one item; you have to add up the COGS for every single product in that bundle.

Imagine you sell high-end coffee and you've created a "Morning Ritual Bundle."

  • One bag of premium coffee beans
  • One ceramic mug
  • A set of two biscotti

To find the bundle's gross margin, your first step is to calculate the total COGS. You'll need to add up the landed cost of each item included.

ItemLanded COGS
Coffee Beans$12.50
Ceramic Mug$8.00
Biscotti Set$3.50
Total Bundle COGS$24.00

Let's say you decide to sell this bundle for $60.00. Perfect. Now you have the two key figures for the formula.

  • Total Revenue: $60.00
  • Total COGS: $24.00

Plugging those in looks like this: ($60.00 - $24.00) / $60.00 = 0.60

Multiply that by 100, and you get a gross margin of 60% for this specific bundle. This simple calculation ensures your popular bundle is actually making you money, not just driving revenue while eating into your profits.

Finding Your Store's Blended Gross Margin

Rarely does a store sell just one thing. To get a true handle on your business's health, you need to figure out your blended gross margin across the entire product catalog. This number is an average that accounts for both the profitability and sales volume of every item you sell.

Think about it: a high-margin product that barely sells has a much smaller impact on your bottom line than a lower-margin bestseller. Calculating the blended margin shows you the combined effect of your entire product mix.

Let's walk through an example for a small online apparel store's performance over one month.

Calculating Blended Gross Margin for a Multi-SKU Store

Here's a breakdown of the sales data for three different products. To find the blended margin, we need to calculate the totals for revenue, COGS, and gross profit across all of them.

Product SKUUnits SoldPrice Per UnitTotal RevenueCOGS Per UnitTotal COGSGross Profit
TEE-001150$30$4,500$10$1,500$3,000
HOOD-00275$65$4,875$25$1,875$3,000
SOCK-003200$15$3,000$4$800$2,200
Totals425$12,375$4,175$8,200

With these totals, we can now calculate the blended gross margin for the whole store that month. We'll use the total revenue and total COGS from all products combined.

Blended Margin Calculation:
(Total Revenue - Total COGS) / Total Revenue
($12,375 - $4,175) / $12,375 = 0.6626

After multiplying by 100 and rounding, you get a blended gross margin of 66.3%.

This single number is an incredibly powerful indicator of your overall profitability. If you see it start to dip month over month, it's a huge red flag. It tells you to investigate whether your product costs went up, if your sales mix shifted toward lower-margin items, or if a recent sale cut too deep.

Doing this manually can get tedious fast, which is why many brands use an eCommerce profit calculator to automate these reports and get real-time insights.

This kind of detailed analysis is what separates businesses that grow sustainably from those that just spin their wheels. To make these calculations even easier as your store grows, you might find a dedicated retail profit margin calculator useful. Mastering these numbers gives you the clarity to make smarter decisions about what to promote, what to discontinue, and how to price new products for maximum profitability.

Gross Margin vs Markup: The Critical Difference

Confusing gross margin with markup is one of the most common—and costly—mistakes an eCommerce founder can make. It's a classic mix-up. On the surface, they both seem to measure profitability, so what's the big deal?

Well, they look at profit from two fundamentally different angles. Mixing them up can lead you to drastically underprice your products and completely hamstring your potential for growth.

Getting this right isn't just about accounting semantics; it’s about building a sustainable pricing strategy. Understanding the distinction ensures you set prices that actually cover all your business expenses and generate the healthy profit you need to reinvest and scale.

Side-by-side comparison of margin and markup, illustrating profit and cost increase concepts on price tags.

Defining Margin and Markup

Let's break down the core difference in simple terms so you never get it twisted again. It all comes down to what you are dividing your profit by—your revenue or your cost.

  • Gross Margin is the percentage of your revenue that is profit. It answers the question, "Out of every dollar in sales, how many cents do I get to keep before paying for operating expenses?"
  • Markup is the percentage you add to your cost to determine your selling price. It answers the question, "How much am I increasing my product's cost to set its price?"

The critical takeaway is this: Gross margin is profit relative to your selling price, while markup is profit relative to your cost. Because margin uses the larger number (revenue) as its base, it will always be a lower percentage than markup for the same product.

Why a 100% Markup Is Not a 100% Margin

This is where the real danger lies. A founder might aim for a 100% markup, thinking they've achieved a massive profit buffer. In reality, a 100% markup only equals a 50% gross margin. This misconception leaves you with far less cash than you thought to cover marketing, salaries, software, and other overhead.

Let's run through a quick example. Imagine you sell a premium leather wallet.

  • Cost of Goods Sold (COGS): $50
  • Selling Price: $100
  • Gross Profit: $50 ($100 - $50)

Now, let's run the numbers for both markup and margin.

Markup Calculation:
Markup looks at the profit in relation to your cost.

  • Formula: (Gross Profit / COGS) x 100
  • Calculation: ($50 / $50) x 100 = 100% Markup

Gross Margin Calculation:
Margin looks at the profit in relation to your revenue.

  • Formula: (Gross Profit / Revenue) x 100
  • Calculation: ($50 / $100) x 100 = 50% Gross Margin

See the difference? The exact same product has a 100% markup but only a 50% gross margin. If you were budgeting your business operations based on a "100% margin," you would be in for a rude awakening when your profits are half what you expected.

A Side-by-Side Comparison

To really nail down the difference, seeing the numbers side-by-side is a game-changer. This table breaks down how each metric is calculated and what it tells you about your business, using the same product data.

Gross Margin vs Markup at a Glance

MetricFormulaExample Calculation (Revenue $100, Cost $60)What It Tells You
Gross Margin(Revenue - COGS) / Revenue($100 - $60) / $100 = 40%What percentage of your total sales price is profit.
Markup(Revenue - COGS) / COGS($100 - $60) / $60 = 66.7%How much you've increased the product's cost to set its price.

Ultimately, while markup is a handy tool for setting prices initially, gross margin is the superior metric for analyzing the true health of your business. It gives you an accurate picture of profitability on every single sale.

This clarity is what you need to make smart, strategic decisions about your marketing spend, operational budget, and overall growth trajectory. Focusing on how to calculate gross margin correctly is a foundational step for any serious eCommerce brand.

Actionable Strategies to Improve Your Gross Margin

Knowing your gross margin is one thing. Actually improving it is where the real work—and the real payoff—begins. A healthier margin gives you the cash flow to pour back into growth, navigate unexpected market shifts, and ultimately build a much more sustainable brand.

This isn’t about making massive, risky changes overnight. More often than not, the biggest wins come from making small, smart tweaks across your business. Let's walk through some proven strategies you can put into play right now.

Reduce Your Cost of Goods Sold

The most direct path to a better margin is to simply pay less for the products you sell. Even shaving a few percentage points off your COGS can create a serious ripple effect on your bottom line. The trick is to cut costs without compromising the quality your customers have come to expect.

Here’s where to start looking for savings:

  • Negotiate Better Supplier Rates: This sounds obvious, but you’d be surprised how many founders never ask. If you've been a good partner and your order volume is growing, you have leverage. Don't just ask for a discount; go into the conversation with your order history and ask about tiered pricing.
  • Consolidate Your Orders: Placing larger but less frequent orders can often unlock volume discounts from your manufacturer. This move also chips away at your per-unit inbound shipping costs, which is a key component of your COGS you can't afford to ignore.
  • Audit Your Packaging: Are you spending a fortune on mailers and void fill? Take a hard look at your shipping materials. Switching to lighter or more compact packaging can slash both material costs and carrier fees, which directly lowers your landed cost for every single unit.

Strategically Adjust Your Pricing

Raising prices feels scary. We've all been there, worried that a price hike will kill conversion rates and send customers running. But when done thoughtfully, a price adjustment can fatten up your margins without a major drop-off in sales.

Instead of a blanket increase across your entire store, get surgical. Zero in on your best-selling products—the ones that have a loyal following and tons of social proof. These items can usually handle a small price bump of 3-5% with very little friction.

A small, strategic price increase on your most popular products often goes unnoticed by most customers but can have a dramatic, positive effect on your overall blended gross margin.

Before you commit, run an A/B test. Use a testing tool to show the new price to a small portion of your traffic and watch your metrics like a hawk. The data will show you whether the extra margin from the higher price makes up for any potential dip in sales volume.

Optimize Your Product Mix and Bundles

Let's be honest: not all of your products are profit superstars. Some naturally carry higher margins than others. Your job is to gently guide customers toward your most profitable items. Do this well, and you can boost your store's overall margin without touching your prices or supplier contracts.

One of the best tools for this is the product bundle.

  • Pair High-Margin Items with Bestsellers: Got a high-margin product that doesn't fly off the shelves on its own? Bundle it with a crowd-pleaser. This is a great way to increase its visibility and move more units.
  • Create Value-Driven Kits: Combine a few related items into a "starter kit" or a complete package. Customers see this as a great value, and it pushes your average order value way up while blending the margins of multiple products into a single, more profitable transaction.

For instance, if you sell skincare, you could bundle a high-margin face serum with your top-selling moisturizer. You'll move more of the profitable serum and instantly increase the gross profit from that single sale. The focus shifts from profitability per product to profitability per customer.

Common Questions About Calculating Gross Margin

Even with a clear formula in hand, a few questions always pop up once you start digging into your store's profitability. Nailing the answers is key to using gross margin to make smarter decisions for your business.

Let’s run through the most common questions we hear from store owners.

What Is a Good Gross Margin for an eCommerce Business?

There’s no single magic number here. What’s considered a “good” gross margin can vary wildly depending on your niche, product type, and business model.

That said, for most direct-to-consumer (DTC) brands, a healthy target to shoot for is somewhere in the 40-60% range, or even higher if you can swing it.

To put that into context, broad data from sources like the NYU Stern School of Business shows specialty retail averages around 36.5%. Your real goal should be a margin that comfortably covers all your other business expenses—what we call operating expenses (OpEx)—while still leaving enough on the table for net profit.

Operating expenses are things like:

  • Marketing and advertising spend
  • Salaries and contractor fees
  • Software subscriptions (your Shopify plan, for example)
  • Warehouse rent and utilities

The best move is to benchmark against competitors in your specific category. See what’s realistic and sustainable for them, and use that as your starting point.

Should I Include Marketing Costs in My COGS?

Absolutely not. You should never include marketing or advertising costs in your Cost of Goods Sold (COGS). This is probably the single most common mistake we see, and it can seriously mess up your understanding of product-level profitability.

COGS is strictly for the direct costs tied to producing or acquiring your products and getting them ready to sell. Think of it this way: COGS are the costs that scale one-for-one with every unit you sell. Marketing, on the other hand, is an operating expense. It's a cost of doing business, not a cost of the goods themselves.

Keeping these two buckets separate is non-negotiable. If you mix them, you'll never see your true product margin. That makes it impossible to know if your pricing strategy is even working before you spend a single dollar on ads.

How Often Should I Calculate Gross Margin?

For any active eCommerce store, calculating your gross margin on a monthly basis is a must. A year is way too long to wait, and even a quarter can be too slow if the market shifts or supplier costs jump. A monthly review gives you the agility you need to react fast.

A monthly check-in lets you:

  1. Spot Negative Trends Early: Quickly catch if rising supplier costs or higher shipping fees are eating into your profits before they become a big problem.
  2. Measure Promotion Impact: See exactly how that flash sale or discount code affected your bottom line for the month.
  3. Analyze New Product Performance: Figure out if that new product you launched is actually profitable and how it stacks up against the rest of your catalog.

Looking at this metric every month turns gross margin from a boring historical report into a proactive tool for steering the ship. It helps you catch small issues before they snowball into major headaches.


At ECORN, we help Shopify brands master their numbers and scale sustainably. Our experts can help you optimize everything from your pricing strategy to your conversion rates, ensuring your business is built for long-term profitability. Discover how our flexible Shopify solutions can elevate your brand.

Related blog posts

Related blog posts
Related blog posts

Get in touch with us

Get in touch with us
We are a team of very friendly people drop us your message today
Budget
Thank you! Your submission has been received!
Please make sure you filled all fields and solved captcha
Get eCom & Shopify
newsletter in your inbox
Join 1000+ merchants who get weekly curated newsletter with insights, growth hacks and industry wrap-ups. Small reads. Free. No BS.