
Work out gross profit, gross margin, and markup from a cost and a selling price, then price backwards from a target margin without mixing up the two percentages.
Margin calculation starts with one subtraction: take the selling price, subtract the direct cost of producing or selling the item, and the remainder is gross profit. Divide that gross profit by the selling price and multiply by 100, and you have gross margin, the percentage of revenue left after direct costs. Markup uses the same gross profit but divides it by cost, which is why it prints a larger number than margin on the same sale whenever cost is above zero and the sale is profitable. The calculator below covers gross margin and markup only; operating margin and net margin sit further down the income statement.
Gross profit = selling price − cost of goods sold
Gross margin % = (gross profit ÷ selling price) × 100
Enter a non-negative direct cost and selling price. The control returns gross profit in currency, gross margin as a share of the selling price, and markup as the same gross profit measured against cost. It works on the gross layer only, so it does not deduct operating expenses, interest, or tax, and it assumes the price you type is already net of returns, allowances, and discounts.
The denominator matters more than most pricing spreadsheets admit. BDC calculates the gross profit margin ratio by subtracting direct expenses or cost of goods sold from net sales, meaning gross revenues minus returns, allowances and discounts, then dividing by net revenues and multiplying by 100% (BDC, last checked 8 September 2026).
BDC's own example runs like this. A company records $100,000 of net revenues and $35,000 of direct expenses for the period. Subtract one from the other and $65,000 of gross profit remains. Divide $65,000 by $100,000 for 0.65, multiply by 100%, and the gross profit margin ratio is 65%.
The same profit margin formula scales down to a single unit. An item you sell for $100 and produce for $35 carries $65 of gross profit and a 65% gross margin. Change either input and the percentage moves: discount that item to $80 while the cost holds at $35 and gross profit drops to $45, so gross margin falls to 56.25%.
Margin and markup measure the same dollars of gross profit against different bases. Margin divides by the selling price; markup divides by cost.
Markup % = (gross profit ÷ cost) × 100
Swapping the denominator is the whole difference. Measure that gross profit against what the item cost you, rather than against what the customer paid, and the same sale reports as a markup.
Take the $35 cost and $100 price from the example above. Gross profit is $65 either way. As a margin, $65 ÷ $100 gives 65%. As a markup, $65 ÷ $35 gives 1.857, or 185.7%. One sale, two honest percentages, and no arithmetic error between them.
The two examples on this page, side by side:
$35 cost, $100 price: $65 of gross profit is a 65% margin and a 185.7% markup.
$10 cost, $15 price: $5 of gross profit is a 33.3% margin and a 50% markup.
The rule: both percentages use the same gross profit on top and differ only in what sits underneath, so you cannot move between them by adding or subtracting percentage points.
The gap widens as profitability rises. A 50% markup is not a 50% margin: buy at $10, mark up by half to $15, and the $5 of gross profit is 33.3% of the $15 price. Quoting a markup where a supplier or a lender expects a margin overstates profitability, and the error survives every downstream calculation built on it.
Rearranging the gross margin formula lets you price backwards from a margin you want to hit.
Selling price = cost ÷ (1 − target margin)
That is the gross margin equation solved for selling price. If the margin claims 65% of the price, cost has to cover the remaining 35%, so dividing the cost by that remaining share returns the price.
For a $35 cost and a 65% target, that is $35 ÷ 0.35, or $100. For a $12 cost and a 40% target, it is $12 ÷ 0.6, or $20, leaving $8 of gross profit.
Two constraints keep the formula honest. The target margin has to be below 100%, because at exactly 100% the divisor is zero and no finite price satisfies it, and above 100% the arithmetic returns a negative price. The target also has to be expressed as a margin. Pricing a $35 cost to a 65% *markup* gives $57.75, which is only a 39.4% margin, and you would be roughly $42 short of the price you thought you had set.

All three measures start from the same $65 of gross profit on this sale. Margin divides that $65 by the selling price, while markup divides it by cost, which is why the markup percentage is the larger of the two on a profitable sale.
Measure: Gross profit; Calculation: Selling price minus cost of goods sold; Result on a $35 cost / $100 sale: $100 − $35 = $65; What it tells you: The currency left after direct costs, before the expenses deducted further down the income statement
Measure: Gross margin; Calculation: (Gross profit ÷ selling price) × 100; Result on a $35 cost / $100 sale: ($65 ÷ $100) × 100 = 65%; What it tells you: The share of the selling price you keep after direct costs
Measure: Markup; Calculation: (Gross profit ÷ cost) × 100; Result on a $35 cost / $100 sale: ($65 ÷ $35) × 100 = 185.7%; What it tells you: How far the price sits above what the item cost you
The SEC's beginners' guide describes the cost of sales line as the money a company spent to produce the goods or services it sold during the accounting period. Operating expenses come next, and the guide notes that companies can report these lines in various orders.
What the guide places in cost of sales:
The money spent to produce the goods or services the company sold during the accounting period.
What the guide places in operating expenses:
Salaries of administrative personnel.
Costs of researching new products.
Marketing expenses.
The dividing test is stated plainly: operating expenses cannot be linked directly to the production of the products or services being sold.
That boundary decides your gross margin before any formula runs. BDC quotes Beniston on one common slip: since it is unlikely that every employee spends all of their time making goods or providing a service, recording all labour under COGS understates gross margin and could lead to bad decisions, because COGS should only carry the expenses incurred from making and selling that product or service (BDC, last checked 8 September 2026). In manufacturing these direct costs are called cost of goods sold; retail and wholesale businesses call the same thing cost of sales.

Cost on one side, price on the other. Which tray you divide by decides whether you are quoting margin or markup.
Three inputs break the arithmetic or flip its sign, and the calculator says so rather than printing a number.
Selling price of zero: gross margin is undefined. The ratio divides by net revenues, and the cited formula defines no result when that denominator is zero. Giving stock away has a cost you can measure, but not a margin.
Cost of zero: gross margin resolves to 100% because the whole price is gross profit, while markup is undefined, since markup divides by the cost you just set to nothing.
Cost above price: gross profit is negative and so is gross margin. Sell for $100 what cost $120 and you book −$20 of gross profit and a −20% gross margin, which means the sale does not even cover its direct costs, let alone the operating expenses below them.
A negative gross margin on one line is a data question first. Check whether the price is net of a discount and whether a cost that belongs elsewhere landed in COGS before you treat it as a pricing failure.
A margin comparison only means something when both numbers were built the same way. Before you line two of them up, confirm you are using the same margin type on both sides, the same rule about which costs sit in COGS, periods of the same length, and businesses that sell in a broadly similar way.
The last condition is where published figures get misused. BDC reports that law firms, banks, technology businesses and other service industry companies typically show gross profit margins in the high-90% range, because service sector firms carry much lower production costs than goods producers (BDC, last checked 8 September 2026). Comparing a workshop against a law firm on that basis tells you about cost structures, not performance.
BDC also comments that, on the face of it, a gross profit margin ratio of 50 to 70% would be considered healthy, and would be for many types of businesses such as retailers, restaurants, manufacturers and other producers of goods (BDC, last checked 8 September 2026). Read that as one publisher's commentary tied to the sectors it names, not as a threshold every business should clear. Your own trend across comparable periods is usually the more useful benchmark.
Every margin calculation inherits the quality of two ledger figures: revenue and cost of sales. If purchases sit uncategorized or a direct cost lands in an operating expense account, the percentage still calculates and still misleads. Booke AI's published scope sits on that upstream work rather than on the ratio itself: its bookkeeping automation software operates inside bank feeds already connected to QuickBooks Online, with no extra bank connection or separate ledger to manage, and that platform remains the accounting system of record.
Read-only AI Bookkeeper statuses appear beside bank transactions through the browser extension, and low-confidence transactions go to your team for review; availability depends on the connected platform, account configuration, subscription, and current release. Booke's own AI bookkeeping page is blunt about the limit: this kind of software does not remove every accounting decision, make missing evidence irrelevant, or transfer professional responsibility. Deciding what counts as a direct cost, and what a 65% or a 20% margin means for your pricing, stays with you.
Not quite. The SEC's guide describes gross profit, sometimes also called gross margin, as the currency subtotal you get by subtracting the costs of sales from net revenues. In everyday use, gross margin usually means that subtotal expressed as a percentage of net sales, so say which one you mean when the distinction matters.
Because cost is smaller than the selling price whenever the sale is profitable, and markup divides gross profit by that smaller number. A $35 item sold for $100 carries a 65% margin and a 185.7% markup on the identical $65 of gross profit.
Yes. When the direct cost of an item exceeds its selling price, gross profit is negative and so is the margin. A $120 cost against a $100 price gives −$20 and −20%, meaning the sale does not cover its direct costs before any operating expense is deducted.
There is no universal figure. BDC comments that a gross profit margin ratio of 50 to 70% would, on the face of it, be considered healthy for many goods producers such as retailers, restaurants and manufacturers, while noting that service industry companies typically report high-90% gross margins (BDC, last checked 8 September 2026). Treat both as sector commentary and compare yourself against your own comparable periods.
Usually the inputs differ rather than the maths. One number may use gross revenue while the other uses net sales after returns, allowances and discounts, or the two may draw different boundaries between cost of sales and operating expenses. BDC notes that pushing all labour into COGS understates gross margin and can lead to bad decisions.