Get your first month of Zinance free.Get your first month free.Claim my free monthClaim
Metrics

Gross margin, for SaaS and for e-commerce

The same formula, two different sets of inputs. Software margin turns on cost of revenue; e-commerce margin turns on landed cost, fulfilment and returns.

Parag Jain, CPA
Parag Jain, CPAFounder, Zinance·Last updated September 2026·8 min read

Summarize this article
What are you measuring
Gross margin79.0%$395,000 of gross profit on $500,000 of revenue. Everything below this line — sales, marketing, engineering, admin — has to come out of that.
Revenue
$500,000
Hosting and infrastructure
$45,000
Support and customer success
$38,000
Third-party services in delivery
$22,000
Cost of revenue
$105,000
Gross profit
$395,000
Gross margin
79.0%

Gross margin only — operating expenses such as sales, marketing, engineering and general admin sit below this line and are not included. The e-commerce mode charges fulfilment on every order because a returned order is still shipped, refunds the payment fee with the order, and recovers unit cost only on the share of returns you can resell.

Gross margin is what is left of revenue after the cost of delivering it, before any of the costs of running the company. It is the ceiling on everything else: a business with a 40% gross margin has 40 cents per dollar to pay for sales, engineering, rent and profit. For the definition, benchmarks by model and the mistakes that distort it, see gross margin and its dollar counterpart gross profit.

The formula never changes. Gross margin = (Revenue − Cost of goods sold) ÷ Revenue. What changes, completely, is what belongs in that cost line — which is why the calculator above has two modes instead of one box.

What counts as cost of revenue for software

A software company's cost of revenue is what it spends to keep the product delivered to paying customers: hosting and infrastructure, the support and customer-success time that keeps them running, and third-party services the product depends on or resells.

What does not belong there is the engineering team building new features, sales, marketing or admin. Those sit below the gross margin line. Putting R&D into cost of revenue is the most common way a software company understates its own margin, usually by 10 to 20 points, and it makes every downstream comparison wrong.

Why e-commerce margin is a different calculation

For a physical product, the cost line is landed cost plus everything it takes to get the order to the customer, and then the part most calculators ignore: returns.

  • Landed cost is the product plus freight, duty and inbound handling — not the supplier's invoice price.
  • Fulfilment is pick, pack, packaging and outbound shipping. You pay it on every order, including the ones that come back.
  • Payment processing is charged on the sale and refunded with it, so it follows kept revenue.
  • Returns remove the revenue but not the fulfilment cost already spent, and recover the unit cost only to the extent the item can be resold.

That last point is why a 12% return rate costs far more than 12% of margin. The calculator models it explicitly: fulfilment is charged on every order placed, and returned stock is recovered only at the resellable share you enter.

Reading the number

BusinessTypical gross marginWhat moves it
SaaS70–85%Hosting efficiency, support load per customer, what sits in cost of revenue
Marketplace50–70%Take rate, payment costs, whether logistics is carried
E-commerce, own brand40–60%Landed cost, fulfilment, return rate and resale recovery
E-commerce, reseller20–40%Supplier terms and shipping
Services40–60%Delivery staff utilisation

These are ranges, not targets. The useful comparison is your own margin over time and against your own pricing, because the same 45% can be excellent for a reseller and a problem for an own-brand product.

The three mistakes that make the number wrong

  1. Mixing cost and retail prices. Both sides of the calculation must be at cost. Comparing revenue against a retail-priced inventory figure inflates margin by roughly the margin itself.
  2. Leaving returns out. Returns take revenue away and leave the fulfilment cost behind. A margin calculated on orders placed rather than orders kept is always too high.
  3. Sliding costs between the lines. Moving support into operating expenses raises gross margin without changing a thing about the business. Decide where each cost belongs, write it into the chart of accounts, and leave it there.

Where Zinance fits

Gross margin is only as good as the ledger underneath it. If cost of revenue is not separated from operating expenses in the chart of accounts, the number cannot be produced reliably month to month. That separation is part of how we set books up — see bookkeeping, or e-commerce bookkeeping for the inventory and fulfilment side.

Frequently asked questions

What is a good gross margin?+
It depends on the model. Software businesses commonly run 70 to 85 percent, own-brand e-commerce 40 to 60 percent, and resellers 20 to 40 percent. The more useful test is your own trend and whether the margin covers your operating costs with enough left to grow.
What is included in cost of goods sold for SaaS?+
Hosting and infrastructure, the share of support and customer success spent delivering the product, and third-party services the product depends on. Engineering building new features, sales, marketing and admin are operating expenses and sit below the gross margin line.
How do returns affect gross margin?+
More than the return rate suggests. A returned order loses its revenue and its payment fee, but the fulfilment cost has already been spent, and the unit cost is only recovered if the item can be resold. That is why a 12 percent return rate can cost far more than 12 percent of margin.
Is gross margin the same as contribution margin?+
No. Gross margin subtracts the cost of producing and delivering what you sell. Contribution margin subtracts all variable costs of a sale, which usually includes some selling costs as well. Contribution margin is the lower of the two and is the better guide for pricing decisions.
Should shipping revenue be included?+
Yes, if you charge for it, include it in revenue and include the actual shipping cost in cost of goods sold. Netting the two together hides whether your shipping policy is subsidised, which for many e-commerce businesses is one of the larger hidden costs.

Numbers you can actually trust

Zinance is outsourced bookkeeping, tax, and fractional-CFO support built for fast-growing companies, flat pricing, a dedicated human, and books that stay current every day.

Live in 7 business days No long-term contracts Your books belong to you