▶ Stepthrough Courses All tutorials Blog Glossary Prompts Videos Visual guides Cheat sheets Comparisons Start Learning Free

What is gross margin and how do you calculate it?

Quick answer

Gross margin is the percentage of revenue left after subtracting the direct cost of the goods or services you sold, often called cost of goods sold. In words: take sales, subtract what it cost to buy or make the things you sold, then divide the result by sales. The dollar amount before dividing is gross profit.

Last updated

Updated · By Robert Breen

Why it matters for a small business

Gross margin tells you whether the basic deal works. If you sell something for barely more than it costs you, no amount of volume will cover rent, salaries and software. A healthy gross margin leaves room for those overhead costs and for profit. Watching it month to month shows when vendor prices creep up or discounts get too generous.

A made-up example: a distributor sells an order of boxes for 1,000 dollars that cost it 700 dollars to buy. Gross profit is 300 dollars. Gross margin is 300 divided by 1,000, or 30 percent. Which costs count as direct can be a judgment call, especially for service firms, so agree on the definition with your accountant before comparing periods.

In a real lesson: Build an AI Vendor Follow-Up Agent in n8n

The AI Vendor Follow-Up Agent lesson features the kind of business where gross margin is the central number. Ridgeline Supply Co., a made-up warehouse and distribution business, "buys pallets, boxes, stretch wrap and janitorial supplies from vendors and ships them to local businesses." What it pays vendors is its cost of goods sold, and what customers pay it is revenue.

The lesson never mentions prices or margins. Its job is follow-up messages for late and short orders, saved to the Vendor Follow-Ups sheet. But one of them shows how purchasing touches margin: Northwind Wrap's PO 4492 arrived 12 rolls short, and the agent asks the vendor to "ship the missing 12 rolls or issue a credit." Paying for stock you never received quietly raises your cost and shrinks your margin.

The AI Expense Categorizer Agent lesson shows the other side. Costs like Office Supplies and Software & Subscriptions at Maple Street Bookkeeping, also made up, are overhead, not cost of goods sold, so they don't reduce gross margin.

n8n AI Agent node with a system message written for Ridgeline Supply Co.
n8n AI Agent node with a system message written for Ridgeline Supply Co.

Try this lesson free or read the step-by-step guide.

Common confusions

Gross margin vs markup

Margin divides profit by the selling price. Markup divides profit by the cost. In the made-up example, 300 dollars of profit is a 30 percent margin but about a 43 percent markup. Mixing them up leads to underpricing.

Gross margin vs net margin

Gross margin subtracts only direct costs. Net margin subtracts everything, including overhead, interest and taxes, so it is always lower or equal.

Tips

  • Write down which costs you treat as direct, and keep it the same each month.
  • Check gross margin by product or service line, not only for the whole business.
  • Let a spreadsheet formula do the math. Use AI to explain the result, not to calculate it.

More Business terms

Where you use it: free lessons

Frequently asked questions

What is a good gross margin?
It varies widely by industry and business model, so there is no single good number. Compare against your own history and ask your accountant about your industry.
Is gross profit the same as gross margin?
Gross profit is a dollar amount. Gross margin is that amount as a percentage of revenue.

All AI glossary terms, A to Z · Free prompt templates