Business math, made visible

Gross margin calculator

Gross margin calculator

See what remains after the cost of goods sold.

Your result
Ready to calculate
Enable JavaScript to calculate in your browser.

Inputs stay in this browser. Results use your entries and the formula below.

This gross margin calculator starts with revenue and cost of goods sold, calculates gross profit, and expresses that profit as a share of revenue. Both inputs should cover the same period or the same sale. The gross-profit ratio follows the IRS explanation, and the subtraction follows the FDIC business training guide. This page is useful when you have sales and cost figures but have not yet calculated profit. It does not subtract overhead or turn gross profit into net income.

Worked example

Figures from the official example linked below
Source itemPublished value
Selling price$1.60
Purchase cost$1.20
Gross profit40 cents
Gross profit ratio25 percent

In the IRS example, an article purchased for $1.20 is sold for $1.60. Subtracting cost leaves $0.40. Dividing that amount by $1.60 gives a 25% gross margin. Source: IRS: gross profit ratio and markup examples.

How it works

Gross profit = revenue - cost of goods sold
Gross margin (%) = gross profit / revenue * 100

Formula basis: IRS: gross profit ratio and markup examples. Ratios are converted to percentages for display. Intermediate values retain full calculation precision; displayed amounts are rounded.

Use the correct cost category

Cost of goods sold is the cost associated with the goods or services sold in the period. The FDIC guide describes gross profit as sales less cost of goods sold. Use the cost figure from a consistently prepared statement rather than putting every business expense into this input. If you need a margin based on a final profit figure after additional expenses, use the profit margin calculator and enter that figure directly.

Read dollars and percentages together

Gross profit states the amount remaining after the entered cost. Gross margin states that amount relative to revenue. Both results matter when comparing periods with different sales totals. A higher margin does not by itself show a higher dollar profit because revenue may also have changed. The tool displays both measures and makes no assumption about demand, inventory, or future sales.

Avoid mixing purchases with sold inventory

The cost input should match what was sold, rather than an unrelated purchase total. A period with a large inventory purchase can have costs that belong to future sales. This calculator cannot determine inventory treatment from two numbers. Use your accounting records to supply a matching cost amount. Revenue is required to be positive, cost may be zero, and cost above revenue is allowed so the tool can show a gross loss.

Use the formula in a spreadsheet

With revenue in A1 and cost of goods sold in B1, gross profit is =A1-B1. Gross margin is =(A1-B1)/A1 with percentage formatting. These formulas use the same revenue denominator as the IRS gross-profit ratio.

Frequently asked questions

How is gross margin calculated?

Subtract cost of goods sold from revenue, then divide the remaining gross profit by revenue. The result is shown as a percentage.

Is gross profit the same as gross margin?

Gross profit is an amount. Gross margin here is that amount expressed as a percentage of revenue, following the IRS ratio explanation.

Does gross margin include overhead?

This tool subtracts only the cost entered as cost of goods sold. The FDIC guide treats overhead as a further subtraction after gross profit.

Can gross margin be negative?

Yes. When the entered cost of goods sold exceeds revenue, gross profit and the gross margin ratio are negative.

How do I calculate gross margin in Excel?

Use =(A1-B1)/A1 with revenue in A1 and cost of goods sold in B1, then format as a percentage.

Is this an industry benchmark?

No. The calculator evaluates your two inputs. The sourced IRS example demonstrates a formula and does not establish a target for any industry.

Sources

Data as of 2026-10-05. Examples are historical teaching examples, not current prices or market benchmarks. Calculated results are derived from entered values.

Return to the business calculator hub to choose another measure.