Pricing Strategies

Your ecommerce may be losing money and you don’t know it: profit margin calculation

Updated

Puede que tu ecommerce pierda dinero y no lo sepas: el cálculo del margen de beneficio.

Selling a lot does not guarantee making money. A mistake in the margin formula or in VAT turns every sale into a small loss that nobody notices until the end of the quarter.

Profit margin is calculated on the selling price excluding VAT: margin = (price excl. VAT − costs) ÷ price excl. VAT. To set a price that hits a target margin, divide the cost by (1 − margin): with a cost of €100 and a 30% margin, the price excluding VAT is €142.86, not €130.

Key points

  • Margin is expressed on the selling price excluding VAT; markup, on the cost. A 30% markup is equivalent to a 23.08% margin.
  • With a 30% margin on sales, the maximum discount without losing money is 30%. With a 30% markup, any discount above 23.08% already produces a loss.
  • VAT is calculated on the selling price excluding VAT (the taxable amount), never on the cost. Adding VAT on the cost leaves less margin than planned.
  • Gross margin only subtracts the cost of the product. Contribution margin also subtracts commissions, payment fees, shipping and picking, and it is the one that shows whether a particular sale makes money.
  • Cutting prices to match competitors without a calculated minimum price can end in sales below cost.

What profit margin is and how to calculate it

Profit margin is the part of the selling price the company keeps after subtracting costs. It is expressed in euros or as a percentage of the selling price excluding VAT, because the VAT charged to the customer is not income: it is paid over to the tax authority.

The general formula is: margin (%) = (selling price excl. VAT − costs) ÷ selling price excl. VAT × 100. The result changes depending on which costs you subtract, which is why it helps to distinguish three margins.

Gross margin, contribution margin and net margin

The three margins start from the same price excluding VAT and differ in the costs they subtract. In e-commerce, the one most often forgotten is contribution margin, which is the one that really tells you whether a product makes or loses money on each order.

IndicatorWhat is subtracted from the price excl. VATWhat it is for
Gross marginPurchase or production cost of the productComparing products and suppliers
Contribution marginAlso the variable costs of each sale: marketplace commission, payment fees, shipping, packaging, pickingKnowing whether a particular sale makes money and setting the minimum price
Net marginAlso fixed costs (staff, rent, software), interest and corporation taxMeasuring the company’s profitability over a period

The following example, with Spanish VAT (21%), shows the first two for a product sold on a marketplace at €121 including VAT. In the example, the marketplace charges 15% on the total amount the customer pays, and all costs are shown excluding VAT, because a VAT-registered business deducts the VAT it pays on its purchases.

ItemAmount
Selling price incl. VAT€121.00
VAT (21%), paid over to the tax authority−€21.00
Selling price excl. VAT€100.00
Purchase cost−€55.00
Gross margin€45.00 (45%)
Marketplace commission (15% of €121)−€18.15
Shipping−€5.50
Packaging and picking−€1.35
Contribution margin€20.00 (20%)

Anyone who calculates margin on the €121 collected thinks they earn €41.00 per unit (121 − 55 − 25). In reality they earn €20.00, because €21.00 is VAT. That mistake doubles the apparent profit.

Margin vs markup

Markup measures the same thing as margin but on a different base: markup = (price excl. VAT − cost) ÷ cost. With a cost of €100 and a price of €130, the markup is 30% and the margin is 23.08% (30 ÷ 130).

The two measures are converted with two formulas: markup = margin ÷ (1 − margin) and margin = markup ÷ (1 + markup). The table shows the most common equivalents.

Margin on salesEquivalent markup on costPrice excl. VAT for a cost of €100
10%11.11%€111.11
20%25.00%€125.00
25%33.33%€133.33
30%42.86%€142.86
40%66.67%€166.67
50%100.00%€200.00

Neither measure is wrong. The problem arises when the price is calculated with a markup and then treated as if it were a margin, which is exactly the first trap.

No credit card · No commitment

The traps: three mistakes that cost you margin

Calculating margin looks simple: price excluding VAT minus costs. Losses appear at three specific points: the formula used to set the price, the VAT calculation and price cuts that ignore costs.

How to get the calculations right: the margin formula trap

Mistakes when applying discounts in an online shop caused by miscalculating the margin

The most common mistake is applying the margin percentage to the cost instead of to the selling price. A product costs €100 and you want to earn 30%. The usual answer is to sell it for €130, and that is where the problem starts.

At €130, the 30% is a markup, not a margin: on the selling price you only earn 23.08%. You will notice as soon as you run a promotion. If you apply a 25% discount thinking you still have 5% left, the price drops to €97.50 (130 × 0.75) and you lose €2.50 per unit.

This is the wrong formula, which adds a percentage of the cost to the cost itself:

Price = cost × (1 + target margin % ÷ 100)

And this is the correct formula for the margin to hold on the selling price: price excl. VAT = cost ÷ (1 − margin).

Price = cost ÷ (1 − target margin % ÷ 100)

Applied to the example, the formula gives 100 ÷ 0.70 = €142.86 excluding VAT:

Price = 100 ÷ (1 − 30 ÷ 100) = €142.86

At that price, the same 25% discount leaves the product at €107.14 and a profit of €7.14 per unit (with the exact price, €142.857). The table compares the two methods (amounts excluding VAT, rounded to the cent).

Item30% markup (mistake)30% margin (correct)
Cost€100.00€100.00
Price excl. VAT€130.00€142.86
Real margin on the price23.08%30.00%
Price with a 25% discount€97.50€107.14
Result per unit after the discount−€2.50+€7.14
Maximum discount without a loss23.08%30.00%

The last row is the rule of thumb: with a margin calculated on the selling price, the maximum discount without a loss equals that margin. If your margin is 30%, a 30% discount takes you to zero; any bigger discount puts you in the red. Before a discount campaign, it is worth checking whether the advertised discount is genuine and sustainable.

The VAT trap: calculating it on the cost instead of the selling price

Mistakes in calculating VAT when setting the selling price in an online shop

The second mistake is calculating VAT on the cost instead of on the selling price excluding VAT. It is hard to spot because it does not show up when you sell, but when you review the real margin or prepare the VAT return: the taxable amount of your sales comes out lower than expected. In Spain that return is form 303 (in Spanish), filed quarterly or monthly depending on the regime.

VAT is an indirect consumption tax on supplies of goods and services made by businesses and professionals. It is charged on the taxable amount, which is the value of the sale. In Spain, under Law 37/1992 on VAT (in Spanish), the standard rate is 21%, the rate used in this example; with any other rate the method is the same.

An example with a product costing €100 and a target margin of 5% on sales, to stay competitive, shows the effect. The correct price excluding VAT is 100 ÷ 0.95 = €105.26. If, when setting the shelf price, you add 21% of the cost (€21.00) instead of 21% of the price excluding VAT (€22.10), the customer pays less than they should and the difference comes out of your margin.

ItemVAT on the cost (mistake)VAT on the price excl. VAT (correct)
Cost€100.00€100.00
Planned price excl. VAT (5% margin)€105.26€105.26
VAT added when setting the shelf price€21.00 (21% of 100)€22.10 (21% of 105.26)
Price charged to the customer€126.26€127.36
Real taxable amount (price ÷ 1.21)€104.35€105.26
VAT paid over to the tax authority€21.91€22.10
Real profit per unit€4.35 (4.17%)€5.26 (5.00%)

The tax authority does not collect 21% of the cost, but 21% of the taxable amount derived from the price charged: 126.26 ÷ 1.21 = €104.35, with €21.91 of VAT. Real profit falls from €5.26 to €4.35 per unit, 17% less than planned. Over 1,000 units sold in a quarter, the difference is about €900.

With thinner margins, the same mistake leads straight to losses. The rule to avoid it is to set the price excluding VAT from the margin first and then multiply it by 1.21 (or by 1 plus your VAT rate). If the terms get mixed up, the article on the difference between net price and gross price clears them up.

Uncontrolled price cuts

Adjusting prices to the competition is a legitimate strategy to win sales, and competitor price monitoring exists precisely for that. The problem arises when cuts are repeated looking only at the rival’s price and not at your own costs.

The product in the contribution margin example shows this clearly. It has €61.85 of costs per unit that do not depend on the price (55.00 purchase, 5.50 shipping and 1.35 picking) and a 15% commission on the price including VAT. If a competitor cuts prices and you follow, your margin shrinks faster than the price, because the €61.85 of fixed costs per unit do not fall with the price.

Price incl. VATPrice excl. VATCommission (15% of price incl. VAT)Contribution margin
€121.00€100.00€18.15€20.00
€95.00€78.51€14.25€2.41
€91.43€75.56€13.71€0.00
€89.00€73.55€13.35−€1.65

That product stops making money below €91.43 including VAT. The minimum price is calculated in two steps: minimum price excl. VAT = 61.85 ÷ (1 − 0.15 × 1.21) = €75.565, and minimum price incl. VAT = 75.565 × 1.21 = €91.43. Any automatic pricing rule should include that floor, with or without a dynamic pricing tool.

When a product is only competitive below its minimum price, the options are to negotiate the cost with the supplier, change channel or stop selling it on that channel. Cutting the price further only increases the loss on every sale. Price comparison mistakes that eat into your margin make the problem worse, because they lead you to match offers that are not comparable.

No credit card · No commitment

How to tell whether your e-commerce is losing money

Checking whether an online shop is losing money on some products takes a few hours with a spreadsheet. These are the steps:

  1. Export last quarter’s sales by product, with the price charged excluding VAT.
  2. Assign each product its purchase cost excluding VAT, including inbound shipping if you pay it.
  3. Subtract the variable costs of each order: marketplace commission or payment fees, shipping, packaging and picking.
  4. Sort products by contribution margin and flag those that come out negative or close to zero.
  5. Check the formula you use to set prices: margin on the selling price and VAT on the price excluding VAT.
  6. Calculate each product’s minimum price and use it as a floor for any price cut or promotion.
  7. Compare that minimum price with your competitors’ prices: the products where the market sells below your floor are the ones that need a decision, and price intelligence helps separate them from those that can take a price rise.

To set your starting price methodically, the guide on how to price a product develops the formula with more examples.

Frequently asked questions about profit margin

Is profit margin calculated with or without VAT?

Profit margin is always calculated without VAT. The VAT the customer pays is passed on to the tax authority and the VAT you pay on your purchases is deducted, so neither is part of your income or your costs. Calculating margin on the price including VAT inflates it artificially.

What is the difference between margin and markup?

Margin measures profit on the selling price and markup measures it on the cost. With a cost of €100 and a price of €130 excluding VAT, the markup is 30% and the margin is 23.08%. To convert a margin into a markup, divide it by (1 − margin).

How much discount can I give without losing money?

The maximum discount without losing money equals your margin on the selling price, provided the margin includes all the costs of the sale and none of them depends on the price. If part of the costs is a percentage commission, which falls with the price, the limit is slightly higher: the product in the example, with a 20% contribution margin, can take a 24.4% discount (from €121.00 to €91.43) before it makes a loss.

How do you protect your margin when you compete on price?

Protecting your margin requires the cost of each product, competitors’ prices and a rule that stops you going below your minimum. Boardfy is a SaaS platform for competitor price monitoring and dynamic pricing for e-commerce, with direct price updates on Amazon, eBay, Google Shopping and Mirakl marketplaces.

  • Boardfy calculates your margin from the product cost, subtracting marketplace commission, payment fees and other expenses, such as picking.
  • Boardfy lets you set a minimum price or margin and never goes below it.
  • Boardfy reads competitors’ prices every 6 hours and applies your rules every 30 minutes.

Boardfy does not decide your strategy: it applies the rules you set. On channels without a direct connection, the new price is sent to your shop or your ERP. Try Boardfy free for 7 days, no card required.

Related articles

Automation is the future

Hundreds of companies of all sizes already use Boardfy

No credit card · No commitment