May 21, 2026

How to calculate profit margin

Explore this topicOpen ChatGPT

Profit margin shows how much of your revenue you keep as profit after covering costs. Calculating profit margin helps you understand pricing, cost control, and overall business performance. Once you know your margin, you can compare results across time, benchmark against peers, and spot where profitability is slipping.

What is profit margin?

Profit margin is the percentage of your revenue that remains after subtracting costs. It shows how efficiently you turn sales into profit and is a core metric for pricing, planning, and performance tracking.

You track profit margins to:

  • Compare performance over time
  • Benchmark against competitors
  • Identify where cost control or pricing improvements are needed

Tracking margin consistently helps you catch problems early, whether that's rising input costs, pricing that hasn't kept up with inflation, or operating expenses growing faster than revenue.

Profit margin formula

The core profit margin formula divides your profit by revenue and converts the result into a percentage:

Profit margin (%) = (Net income / Revenue) * 100

Here's how to calculate it step by step:

  1. Find your total revenue for the period you want to measure
  2. Subtract all expenses (COGS, operating expenses, interest, and taxes) to get net income
  3. Divide net income by revenue to get a decimal
  4. Multiply by 100 to convert the decimal to a percentage

For example, say your business generates $500,000 in revenue and has $450,000 in total expenses:

  • Net income = $500,000 – $450,000 = $50,000
  • Profit margin = ($50,000 / $500,000) * 100 = 10%

That means you keep 10 cents of every dollar in revenue as profit.

Types of profit margins

There are different ways to calculate profit margin depending on which costs you include. Each type answers a different question about your profitability.

Gross profit margin

Gross profit margin measures how much of your revenue remains after subtracting the cost of goods sold (COGS), such as materials and direct labor. It shows how efficiently you produce or deliver your product or service.

Gross profit margin = (Revenue – COGS) / Revenue * 100

Use gross profit margin to evaluate pricing, sourcing, and production efficiency before accounting for overhead or administrative costs. If your revenue is $500,000 and COGS is $300,000, your gross profit margin is 40%.

Operating profit margin

Operating profit margin goes a step further by subtracting operating expenses, such as salaries, rent, and marketing, from gross profit. It reflects how well you manage day-to-day business costs but excludes interest and taxes.

Operating profit margin = Operating income / Revenue * 100

Service-based businesses often report stronger operating margins, while capital-intensive industries like manufacturing and logistics tend to operate with tighter margins due to higher overhead.

Net profit margin

Net profit margin is the bottom-line profitability metric. It shows what you keep after every expense, including COGS, operating costs, interest, taxes, and one-time charges.

Net profit margin = Net income / Revenue * 100

Because it captures every cost, net profit margin is the most comprehensive view of how profitable your business actually is.

Margin typeWhat it includesWhat it measures
GrossCOGS onlyProduction efficiency
OperatingCOGS + operating expensesOperational efficiency
NetAll expensesOverall profitability

What is the difference between margin and markup?

Margin and markup describe the same dollar of profit but from different angles. Margin is profit as a percentage of the selling price, while markup is profit as a percentage of cost. Confusing the two leads to pricing mistakes.

Take a product that costs you $60 to make and sells for $100:

  • Margin = ($100 – $60) / $100 * 100 = 40%
  • Markup = ($100 – $60) / $60 * 100 = 66.7%

Same $40 in profit, two very different percentages. Markup always looks larger because it's calculated against a smaller base.

When to use margin

Use margin for financial reporting, comparing profitability across products or time periods, and analyzing how much of each sale becomes profit. It's the right metric when you're evaluating overall business performance.

When to use markup

Use markup when you're setting prices. It's the practical lever for figuring out what to charge based on your cost and the profit you want to earn on each unit sold.

What is a good profit margin?

A good profit margin depends on your industry, business model, and growth stage. Comparing your margin to a generic benchmark can be misleading. The better question is whether your margin is improving over time and how it stacks up against peers in your sector—which you can assess through a profitability analysis.

Good profit margins by industry

Service businesses typically post higher margins than retail or manufacturing because their direct costs are lower. Asset-heavy industries with significant inventory or equipment costs usually run leaner. Here's a general sense of how margins tend to compare across sectors:

  • Software and SaaS: Generally higher margins, since the cost to deliver each additional unit is low
  • Professional services and consulting: Higher margins driven by labor rather than physical inputs
  • Retail and e-commerce: Lower margins due to inventory, fulfillment, and competitive pricing pressure
  • Manufacturing: Lower margins reflecting higher capital and labor costs
  • Grocery and food service: Among the thinnest margins because of high competition and low-cost inputs

Benchmark against averages relevant to your sector rather than chasing a universal number. A 10% margin can be excellent in one industry and concerning in another.

How to calculate profit margin percentage in Excel

Excel makes it easy to calculate margin once you know the formula. The basic formula is:

=(Revenue Cell – Cost Cell) / Revenue Cell

Then format the cell as a percentage. Here's how to build a simple margin calculator in four steps:

  1. Step 1: Enter your revenue in one cell (for example, B2)
  2. Step 2: Enter your total costs in another cell (for example, B3)
  3. Step 3: In a third cell, enter the formula
  4. Step 4: Format that cell as a percentage

From there, you can link the spreadsheet to accounting exports so revenue and expense data update automatically. That keeps margin calculations accurate as the numbers change.

How to improve your profit margin

Calculating margin is just the starting point. Improving it comes from a mix of better data, smarter pricing, and tighter cost control, not blanket cost cutting.

1. Track income and expenses consistently

You can't improve what you don't measure. Consistent expense tracking is the foundation for any margin improvement effort because it shows you exactly where revenue is going.

Inconsistent categorization, missing receipts, and delayed reporting all distort your margin numbers. Clean, current data lets you spot cost creep before it eats into profitability.

2. Automate financial processes

Manual processes waste time and introduce errors that compound over the course of a year. Automating expense categorization, receipt collection, and accounting workflows frees your finance team to focus on analysis instead of data entry.

Automation also gives you faster visibility into spending. When transactions are coded in real time, you don't have to wait until month-end close to see how margins are trending.

3. Reduce operating costs

Review recurring expenses regularly to find savings that don't hurt output. Renegotiating supplier contracts, eliminating redundant software, and consolidating tools can all trim overhead.

Pay close attention to underused subscriptions and shadow IT spending. These quietly drain margins without anyone noticing until you do a full audit.

4. Optimize your pricing strategy

Use margin calculations to make sure your pricing covers costs and delivers the profitability you need. If you have a target margin in mind, you can reverse-engineer the right price using this formula:

Price = Cost / (1 – Target margin)

For example, if a product costs $60 and you want a 40% margin, divide $60 by 0.60 to get a selling price of $100. Test price changes gradually to balance margin gains against any impact on demand.

Track profit margins in real time with Ramp's automated expense categorization and reporting

Calculating profit margins accurately requires clean expense data, but manual categorization and scattered receipts create opportunities for error. Ramp's accounting automation software eliminates the guesswork by coding every transaction automatically, collecting receipts in real time, and syncing everything to your ERP so you always know where your money goes.

Ramp's AI learns your chart of accounts and applies the right GL codes, departments, classes, and locations to every expense as it posts. You get complete visibility into cost centers and spending patterns without chasing down receipts or fixing miscoded transactions after the fact. When expenses land in the right categories from day one, you can calculate margins with confidence and spot trends before they impact profitability.

Here's how Ramp helps you track and improve margins:

  • AI-powered coding: Ramp codes transactions across all required fields in real time, so expenses are categorized correctly and margins reflect actual costs
  • Automated receipt collection: Ramp texts employees for missing receipts and matches them to transactions automatically, eliminating the manual work that slows down reporting
  • Real-time spend visibility: Track expenses by department, project, or cost center as they happen, so you can identify margin erosion early and adjust spending before it's too late
  • Seamless ERP sync: Ramp syncs coded transactions to your accounting system automatically, so financial reports are always current and margin calculations are based on complete data

Try a demo to see how Ramp gives you the clean expense data you need to calculate and improve profit margins.

Try Ramp for free
Share with
Ken BoydAccounting and finance expert
Ken Boyd is a former CPA, accounting professor, writer, and editor. He has written four books on accounting topics, including The CPA Exam for Dummies. Ken has filmed video content on accounting topics for LinkedIn Learning, O’Reilly Media, Dummies.com, and creativeLIVE. He has written for Investopedia, QuickBooks, and a number of other publications. Boyd has written test questions for the Auditing test of the CPA exam, and spent three years on the Audit staff of KPMG.
Ramp is dedicated to helping businesses of all sizes make informed decisions. We adhere to strict editorial guidelines to ensure that our content meets and maintains our high standards.

FAQs

Divide your cost by 0.80 (which is 1 minus 0.20) to find the selling price needed to achieve a 20% margin. For example, a product that costs $40 would need to sell for $50 ($40 / 0.80) to deliver a 20% margin.

Divide your cost by 0.70 (which is 1 minus 0.30) to find the required selling price. A product that costs $70 would need to sell for $100 ($70 / 0.70) to hit a 30% margin.

The profit margin ratio is net income divided by revenue, expressed as a decimal or percentage. It's the same calculation as net profit margin and is one of the most common profitability ratios used in financial analysis.

Subtract the cost from the selling price to find your profit, then divide that profit by the selling price and multiply by 100. For example, if you sell something for $200 that cost $150, your margin is ($200 – $150) / $200 × 100 = 25%.

Not necessarily. Very high margins can sometimes signal underinvestment in growth, hiring, or product development, while lower margins can be perfectly sustainable in high-volume businesses like grocery or e-commerce. Context, trend lines, and industry benchmarks matter more than the raw number.

Browserbase builds infrastructure so AI agents can do real work. Ramp is doing the same for finance. It’s not another tool. It’s a system purpose-built for AI-driven finance, and that’s why we chose Ramp as our financial operating system from day one.

Paul Klein IV

Founder & CEO, Browserbase

How the startup that helped design Ramp’s procurement agent automated its own procure-to-pay

We used to pay up to $20k a year for our AP platform. With Ramp, we’re earning back well over that amount. That's money that belongs to the mission now, not to the back-office software.

Heidi Coffer

Chief Financial Officer, Boys & Girls Clubs of San Francisco

Boys & Girls Clubs of San Francisco used to pay for their finance software — now it pays them

We're accountable to our funders, our partners, and the families we serve. That accountability starts with how we manage every dollar. Ramp makes it easy for our team to spend wisely, track in real time, and keep overhead low so more resources reach the families navigating infertility.

Rachel Fruchtman

CFO, Jewish Fertility Foundation

Jewish Fertility Foundation reclaimed 11 work weeks and put more time into serving families

Each member of our team has an outsized impact due to our focus on using high-leverage tools like Ramp.

Lauren Feeney

Controller, Perplexity

How Perplexity's finance team of 10 scales one of the fastest-growing AI startups

With Ramp, we haven’t had to add accounting headcount to keep up with growth. The biggest takeaway is that instead of hiring our way through it, we fixed the workflow so we can keep supporting the organization as we scale.

Melissa M.

VP of Accounting at Brandt Information Services

Brandt grew finance operations 3x with zero added accounting headcount

In the public sector, every hour and every dollar belongs to the taxpayer. We can't afford to waste either. Ramp ensures we don't.

Carly Ching

Finance Specialist, City of Ketchum

City of Ketchum saves 100+ hours to make every taxpayer dollar count

Compared to our previous vendor, Ramp gave us true transaction-level granularity, making it possible for me to audit thousands of transactions in record time.

Lisa Norris

Director of Compliance & Privacy Officer, ABB Optical

From 2 months to 2 days: ABB Optical's Sunshine Act compliance breakthrough

We chose Ramp because it replaced several disparate tools with one platform our teams actually use—if it’s not in Ramp, it’s not getting paid.

Michael Bohn

Head of Business Operations, Foursquare

Painless procurement in half the time: Foursquare's single system for spend