Skip to content
← Back to Journal
Business finance
11 min read

Gross margin and net margin: how to calculate them step by step

Gross-margin and net-margin formulas with real examples, an income statement table and the mistakes that inflate your profitability on paper.

By Equipo Frihet
Gross margin and net margin: how to calculate them step by step

TL;DR: Gross margin measures what each sale leaves after subtracting only the direct cost of producing it: (Revenue − Cost of sales) / Revenue × 100. Net margin measures what remains after ALL expenses, interest and tax: Net profit / Revenue × 100. A healthy gross margin with a tiny net margin points to an oversized cost structure; a poor gross margin is not fixed by cutting office costs but through price or direct cost. Calculate both every month, not once a year.

Key takeaways

  • Gross margin = (Revenue − Cost of sales) / Revenue × 100. Only the direct cost of what was sold is included: goods, raw materials and direct labour.
  • Net margin = Net profit / Revenue × 100, after all overheads, depreciation and amortisation, interest and tax.
  • Output VAT and deductible input VAT are excluded from margin. Non-deductible input VAT does form part of cost, so use amounts net of recoverable VAT and check the business’s VAT regime.
  • For a company in Spain, the final step to net margin is Corporate Income Tax: the standard rate is 25%; qualifying microenterprises pay 19% on the first €50,000 of taxable income and 21% on the remainder in periods beginning in 2026 (Article 29 and transitional provision 44 of Law 27/2014).
  • A 30% markup on cost is NOT a 30% gross margin: it is 23.1%. Confusing the basis of calculation causes more incorrectly set prices than any other error.
  • The gap between gross and net margin is your diagnosis: low gross margin = price or direct-cost problem; high gross margin with low net margin = overhead problem.
Contents

Gross margin subtracts the direct cost of what you sold from revenue and divides by revenue: Gross margin (%) = (Revenue − Cost of sales) / Revenue × 100. Net margin divides final profit, after all expenses, interest and tax, by the same revenue: Net margin (%) = Net profit / Revenue × 100. If you sell something for €100,000 that cost €62,000 to produce, your gross margin is 38%; if €9,000 remains after rent, payroll, software, depreciation and amortisation, and tax, your net margin is 9%. Gross margin tells you whether your product is profitable; net margin, whether your company is.

What gross margin is and how to calculate it

Gross margin measures how much each euro of sales leaves you before paying overhead. The numerator only includes revenue and cost of sales (also called COGS, or cost of goods sold): what it directly costs you to produce or acquire the item you invoice.

The formula:

Gross margin (%) = (Revenue − Cost of sales) / Revenue × 100

What is included in cost of sales:

  • Retail and distribution: the purchase price of the goods sold, plus inbound freight and customs duties, if any.
  • Manufacturing: raw materials, direct production labour and costs directly attributable to manufacturing each unit.
  • Services: hours worked by the team delivering the project directly (not administration), subcontractors and licences attributable to the customer.
  • SaaS and digital: server infrastructure, usage-based third-party API costs and support directly connected with the service.

What is not included: office rent, administration and sales payroll, marketing, advisers, management software and loan interest. All of that appears lower down the income statement and affects net margin, not gross margin.

Unit gross margin vs overall gross margin

You can calculate gross margin for the whole company (using aggregate figures for the period) or for each product, service or business line. The latter is where decisions live: a concentration analysis may reveal that a small share of the catalogue generates most gross profit, while some items sell in volume but leave almost nothing. Without a product-level breakdown, the overall margin is an average that hides both the profit engines and the holes.

What net margin is and how to calculate it

Net margin measures what really remains in the company after everything: cost of sales, overheads, depreciation and amortisation, interest and tax.

Net margin (%) = Net profit / Revenue × 100

The following are deducted between gross and net margin, in order:

  1. Operating expenses (OPEX): rent, utilities, payroll and Social Security costs for non-productive staff, marketing, advisers, insurance and software.
  2. Depreciation and amortisation: accounting for wear and use of machinery, equipment, vehicles and intangible assets.
  3. Finance result: interest on loans and credit facilities, less finance income, if any.
  4. Tax on profit: Corporate Income Tax if you are a company; personal income tax if you are a freelancer.

The final step: tax on profit

In Spain, Corporate Income Tax separates a company’s profit before tax from its net profit. These are the Spanish rates for tax periods beginning in 2026, according to the AEAT (article 29 and transitional provision 44 of Law 27/2014):

Type of entity Tax rate (periods beginning in 2026)
Standard rate 25%
Microenterprise (turnover < €1m) — first €50,000 of taxable income 19%
Microenterprise (turnover < €1m) — remainder of taxable income 21%
Small company (turnover < €10m) 23%
Newly formed entity (first period with positive taxable income and the following one) 15%

Reduced rates are subject to the requirements and exclusions in the Corporate Income Tax Law, and some entities must apply a different rate. The table supports the management example; it does not determine a specific company’s tax liability by itself.

If you operate as a freelancer, there is no fixed rate: income from your activity is included in your general personal income tax base and taxed at progressive rates together with your other income. You can find the details in our personal income tax guide for freelancers.

Gross vs net in a real example: the income statement

The clearest way to see the difference is to work down an income statement. Take a Spanish service company with annual revenue of €240,000 (all figures exclude VAT). Assume it qualifies for the 2026 microenterprise rates and that its €30,000 accounting profit before tax equals taxable income.

Item Amount % of revenue
Revenue €240,000 100%
− Cost of sales (project team + subcontractors) −€132,000 55%
= Gross profit €108,000 45% (gross margin)
− Operating expenses (rent, administration, marketing and software) −€68,000 28.3%
= EBITDA €40,000 16.7% (EBITDA margin)
− Depreciation and amortisation −€6,000 2.5%
= Operating profit (EBIT) €34,000 14.2% (operating margin)
− Finance interest −€4,000 1.7%
= Profit before tax €30,000 12.5%
− Corporate Income Tax (2026 microenterprise: 19% of €30,000) −€5,700 2.4%
= Net profit €24,300 10.1% (net margin)

The same company, three readings: a 45% gross margin (the service itself is profitable), a 14.2% operating margin after depreciation and amortisation and a 10.1% net margin (what truly remains). Each step answers a different question, and knowing how to read the full income statement turns these figures into decisions.

Operating margin: the middle step almost nobody watches

Between gross and net sits the operating margin: operating profit divided by revenue. In this example EBIT includes depreciation and amortisation, while EBITDA is measured before those charges. Both exclude interest and income tax.

Two companies with identical operations can have very different net margins simply because one was financed with debt and the other with equity. Their operating margin, by contrast, will be the same. Therefore:

  • To compare your business with itself quarter by quarter: operating margin.
  • To decide prices and product mix: gross margin.
  • To know how much you can distribute or reinvest, or what to do with profit: net margin.

Five mistakes that inflate (or crush) your margin on paper

1. Calculating with VAT-inclusive prices

The most common mistake. If you sell for €121 including standard VAT and the net recoverable cost is €80, revenue for the margin is €100 and gross margin is 20%, not 33.9%. If some input VAT is non-deductible, add that part to cost instead of removing it automatically.

2. Confusing margin with markup

Applying “30% margin” to cost (cost × 1.30) does not produce a 30% gross margin; it produces 23.1%: markup is calculated on cost and margin on selling price. With a 50% markup, margin is 33.3%. It is the costliest denominator error in pricing, and we have a complete guide to the difference between margin and markup.

3. Forgetting “invisible” direct costs

Freight, payment-gateway fees, packaging, waste, returns and marketplace commission. Each appears small; together, they can consume 5–10 gross-margin points without ever appearing in your quick back-of-the-envelope calculation.

4. Failing to account for the owner’s work

If the owner works for free — or below market rates — the company’s reported margin is subsidised by the salary they do not receive. The day someone must be hired to replace them, the true margin emerges, and it is sometimes negative.

5. Calculating once a year

A margin calculated in April using the previous year’s figures is archaeology, not management. Procurement costs change, prices become outdated and the product mix shifts. A margin calculated 14 months late did not warn you about anything; it told you after the event.

Levers for improving each margin

The great advantage of separating gross and net margin is that each has its own levers, and confusing them leads to cutting in the wrong place.

To raise gross margin

  • Price: the most powerful and underused lever. In a business with a 40% gross margin, raising prices by 5% without losing volume increases gross profit by 12.5%. There are techniques for doing so without losing customers along the way, and it starts by setting prices methodically rather than copying others.
  • Direct cost: renegotiate with suppliers based on volume or payment terms, find alternative sources, and reduce waste and returns.
  • Mix: sell proportionally more of the higher-margin lines. This requires changing neither prices nor costs, only directing sales effort using data.

To raise net margin (when gross margin is healthy)

  • Overhead: review each recurring fixed expense once a year by asking, “What would happen if this disappeared tomorrow?” Zombie expenses (unused licences and duplicate subscriptions) rarely fall by themselves.
  • Financing: refinancing expensive debt and adjusting collection and payment policies reduces negative finance results.
  • Legitimate tax planning: apply the deductions and reductions to which you are entitled. Corporate Income Tax has specific deductions that many companies simply do not claim.

From a quarterly spreadsheet to margin in real time

Everything above only works if the data exists and is current. That is the real bottleneck: in most businesses, calculating margin means exporting invoices from one system, expenses from another, combining them in a spreadsheet and hoping the categories reconcile. The result is that it happens once a quarter, at best.

A management system where invoices and expenses live in one place removes that work: every invoice issued and every categorised expense automatically feeds the income statement, and gross, operating and net margin stop being an annual exercise and become figures you check as naturally as your bank balance. In Frihet, you can also ask the AI directly — “How has my gross margin by line changed this quarter?” — and receive an answer calculated from your actual data, without exporting anything. The free plan includes up to 999 invoices per month, so the cost of starting to measure properly is exactly zero.

The tool is not what matters; cadence is. A margin reviewed every month detects erosion while it is still cheap to correct. One reviewed every year is only useful for writing the post-mortem.

Share

Was this article helpful?

FAQ

What is the difference between gross margin and net margin?

Gross margin subtracts only the direct cost of what was sold (goods, raw materials and direct labour) from revenue and measures the profitability of the product or service itself. Net margin also subtracts all overheads (rent, indirect payroll, software and marketing), depreciation and amortisation, interest and tax, and measures the final profitability of the business as a whole. A business can have an excellent gross margin and a negative net margin if its overhead is greater than its sales volume can support.

How is gross margin calculated?

Gross margin (%) = (Revenue − Cost of sales) / Revenue × 100. Example: you sell products for €100,000 that cost you €62,000. Gross margin = (100,000 − 62,000) / 100,000 × 100 = 38%. Important: use amounts net of recoverable VAT and divide by revenue, not cost (that would be markup, a different metric).

Is VAT included when calculating margin?

As a general rule, exclude output VAT from revenue and deductible input VAT from costs. The important exception is non-deductible input VAT, which does form part of the cost of the good or service. Use amounts net of recoverable VAT and adapt the calculation to the business’s VAT regime; simply dividing every gross price by 1.21 is not reliable.

What is considered a good net margin?

It depends radically on the business model: a distributor moving high volume can be very profitable with a single-digit net margin, while a professional-services or software company often needs a double-digit net margin to be sustainable. More useful than comparing yourself with a magic number is comparing your net margin with your own history (is it improving or worsening quarter by quarter?) and monitoring the gap between gross and net margin, which reveals the weight of your overhead.

Does a freelancer calculate net margin in the same way as a company?

The mechanics are the same up to profit before tax. The difference is in the final step: a company subtracts Corporate Income Tax (standard rate of 25%, with reduced rates for microenterprises and small companies), while a freelancer pays personal income tax at progressive rates that depend on their total taxable income, not only the business. The freelancer must also impute a market salary for their own work before reading the margin: otherwise, the apparent net margin includes their hidden salary and is inflated.

Compare with

What's new at Frihet and practical guides, in your inbox

At most one email a month. Every email includes a link to unsubscribe.

We will use your email only to send you this newsletter.

Frihet — Business without drama

Start Free