To calculate profit margin, subtract all costs from the selling price, divide by the selling price and multiply by 100. A product that sells for $29.99 and costs $22.00 in total (product, shipping, ads and fees) earns $7.99 profit, so its margin is 7.99 ÷ 29.99 = 26.6%. Gross margin counts only the product cost.
Most online sellers overestimate their margin because they leave out shipping, marketplace fees, payment processing and ad spend. This guide gives the gross and net margin formulas, a full per-unit example with every cost, a monthly net margin example, the formula for pricing to a target margin, and the mistakes that make a profitable-looking product lose money. Fees are shown as variables you fill in from your own marketplace's fee page.
- Profit margin = (price − total cost) ÷ price × 100.
- Gross margin uses only the cost of the product (cost of goods sold). Net margin subtracts every cost, including fees, shipping, ads and overhead.
- Example: $29.99 price, $22.00 total per-unit cost = $7.99 profit = 26.6% margin, even though gross margin is 71.7%.
- Price for a target margin = fixed costs ÷ (1 − margin − percentage fees). For a 30% margin in the example: $31.92.
- Margin is not markup. A 50% markup is a 33.3% margin.
What is the profit margin formula?
Profit margin = profit ÷ revenue × 100, where profit is revenue minus costs. Which costs you subtract decides which margin you're measuring.
| Margin | Formula | What it tells you |
|---|---|---|
| Gross margin | (Revenue − cost of goods sold) ÷ revenue | Whether the product itself is priced above what it costs to make or buy |
| Contribution margin (per unit) | (Price − all per-unit costs) ÷ price | What each sale actually adds after fees, shipping and ads |
| Operating margin | (Revenue − COGS − operating expenses) ÷ revenue | Whether the business covers its running costs |
| Net margin | Net profit ÷ revenue | What you keep after everything, including tax and interest |
For a small online shop, the two that matter day to day are gross margin (for comparing products) and per-unit contribution margin (for deciding whether a sale is worth making). Net margin is the monthly scorecard.
How do I calculate gross profit margin?
Subtract the cost of goods sold from the price and divide by the price. If you buy a product for $8.50 and sell it for $29.99, gross profit is $21.49 and gross margin is 21.49 ÷ 29.99 = 71.7%.
Cost of goods sold (COGS) is what it costs to make or buy the item: wholesale price, materials, and inbound freight to get stock to you. It doesn't include the fees and shipping you pay when you sell. That's why gross margin looks generous for online sellers, and why it isn't the number to price from.
How to calculate profit margin with fees and shipping
List every cost of one sale, add them up, and subtract from the price. Percentage fees are calculated on the sale price, so work them out first.
- Product cost: what one unit costs you (COGS).
- Shipping cost: what you pay the carrier per order, if the buyer doesn't pay it in full. Bulky items are billed by dimensional weight, so check the real label cost.
- Packaging and other costs: box, mailer, tape, insert card.
- Ad spend per unit: total ad spend ÷ units sold from those ads.
- Marketplace fee: price × your marketplace's percentage, plus any fixed per-order fee.
- Payment processing fee: price × processing percentage, plus any fixed fee.
- Profit = price − all of the above. Margin = profit ÷ price.
Worked example: a $29.99 product
The fee rates here are placeholders (15% marketplace fee, 3% + $0.30 processing). Swap in the current numbers from your marketplace's fee page, because they vary by platform, category and country.
| Line | Calculation | Amount |
|---|---|---|
| Selling price | $29.99 | |
| Product cost | $8.50 | |
| Shipping label | $4.20 | |
| Ad spend per unit | $3.00 | |
| Packaging | $0.60 | |
| Marketplace fee (15%) | 29.99 × 0.15 | $4.50 |
| Processing fee (3% + $0.30) | 29.99 × 0.03 + 0.30 | $1.20 |
| Total cost | $22.00 | |
| Profit | 29.99 − 22.00 | $7.99 |
| Profit margin | 7.99 ÷ 29.99 | 26.6% |
Amounts are rounded to the cent; the unrounded total is $21.998 and profit is $7.99 either way. The same product has a 71.7% gross margin but a 26.6% margin per sale once everything is counted. You can run this with your own numbers in our free profit margin calculator, which takes product, shipping, ad and other costs plus percentage and fixed fees, and shows profit, margin, markup and ROI. It has no built-in fee tables, so you type the fees from your own platform.
Marketplace and payment fees change, differ by category, and some (like advertising programs or currency conversion) only apply to some orders. Keep the percentages in one place, check the fee page each quarter, and re-run your margins when they change.
How do I price a product for a target margin?
Divide your fixed per-unit costs by (1 − target margin − percentage fees). Because percentage fees grow with the price, you can't simply add your margin on top of costs.
Using the example: fixed per-unit costs are $8.50 + $4.20 + $3.00 + $0.60 + $0.30 (the fixed part of the processing fee) = $16.60. Percentage fees are 15% + 3% = 18%. For a 30% margin: $16.60 ÷ (1 − 0.30 − 0.18) = $16.60 ÷ 0.52 = $31.92. Check: at $31.92, fees are $6.05, total cost is $22.35, profit is $9.57, and 9.57 ÷ 31.92 = 30.0%.
| Target margin | Formula | Price needed |
|---|---|---|
| 0% (break-even) | 16.60 ÷ 0.82 | $20.24 |
| 20% | 16.60 ÷ 0.62 | $26.77 |
| 25% | 16.60 ÷ 0.57 | $29.12 |
| 30% | 16.60 ÷ 0.52 | $31.92 |
| 40% | 16.60 ÷ 0.42 | $39.52 |
If the price your market accepts is below the break-even line, the fix is on the cost side: cheaper shipping (a smaller box, see how to calculate dimensional weight), lower ad cost per sale, or a better supplier price.
How do you calculate net profit margin for a month?
Take the month's revenue, subtract every cost, including fixed costs that don't belong to any one order, and divide by revenue.
Say you sell 300 units of the example product. Revenue: 300 × $29.99 = $8,997.00. Per-unit profit: 300 × $7.9918 = $2,397.54. Fixed monthly costs (store subscription, apps, software, a photo budget) come to $600. Net profit before tax: $2,397.54 − $600 = $1,797.54. Net margin: 1,797.54 ÷ 8,997.00 = 20.0%.
Fixed costs shrink as a share of revenue when you sell more, which is why the same product has about a 17% net margin at 200 units and about 22% at 400. Income tax comes after this; talk to an accountant for that part, as this guide isn't tax or financial advice.
Photo costs are part of overhead. Make white-background, lifestyle and channel-size images from one product photo instead of paying for a reshoot per channel.
Make product photos7 days free · 50 credits · No credit cardWhat is a good profit margin for an online store?
There's no universal target, but a common rule of thumb is that per-sale margins under about 20% leave little room for returns, discounts and rising ad costs. Ranges vary a lot by category: resold branded goods often run thin, while handmade, private-label and digital products can run much higher. Compare your own products against each other and watch the trend rather than chasing an industry average.
- Check margin after a discount, not just at full price. A 20% sale on the $29.99 example ($23.99) cuts profit per unit from $7.99 to about $3.07; how to calculate discount percentage shows the deepest safe discount.
- Count returns. If 5% of orders come back unsellable, add 5% of product cost to every unit.
- Include ad spend per unit, not per click.
- Re-run margins after every carrier or fee change.
Profit margin mistakes to avoid
| Mistake | Why it misleads | Fix |
|---|---|---|
| Dividing profit by cost | That's markup, not margin, and looks bigger | Divide by the selling price |
| Ignoring percentage fees | Fees grow with price | Use the target-margin formula |
| Leaving out shipping | Free shipping is a cost | Use the real label cost per order |
| Using gross margin to price | Fees and ads come out later | Price from per-unit contribution |
| Forgetting fixed costs | Per-sale profit isn't take-home | Track monthly net margin |
The first mistake is so common it has its own guide: markup vs margin explains the difference and has a conversion table. If you make what you sell, how to price handmade products adds labor and overhead to the formula.
Frequently asked questions
How do you calculate profit margin?
Subtract total costs from the selling price, divide by the selling price and multiply by 100. A $29.99 product with $22.00 in total costs makes $7.99 profit, which is a 26.6% profit margin.
What is the difference between gross and net profit margin?
Gross margin subtracts only the cost of goods sold from revenue. Net margin subtracts everything: fees, shipping, advertising, overhead, and eventually tax and interest. Net margin is always lower and is what you actually keep.
How do I calculate a 30% profit margin?
Divide your costs by 0.70 if you have no percentage fees: a $14 cost needs a $20 price. If your marketplace and payment fees take a percentage of the price, divide by (1 − 0.30 − fee rate) instead.
Is profit margin the same as markup?
No. Margin is profit divided by the selling price; markup is profit divided by cost. A product bought for $20 and sold for $30 has a 50% markup but a 33.3% margin.
Should shipping be included in profit margin?
Yes, whatever you pay for shipping that the buyer doesn't fully cover is a cost of the sale. If the buyer pays shipping, include it in revenue and the label in costs, and remember some marketplaces charge their percentage fee on shipping too.
What is a good profit margin for an ecommerce product?
It depends on the category, but many sellers aim for at least 20% per sale after all fees, shipping and ads, so there is room for discounts and returns. Handmade and private-label products can often go higher than resold branded goods.
Turn the product photos you already have into clean white, lifestyle and channel-size images, with the product kept exactly as shot, so photography stays a small line on your costs.
Start free trialSee pricing7 days free · 50 credits · No credit card. Trial images carry a small “Made with aiarter” mark; paid plans export clean files you can use commercially.



