Learn how to calculate the cost of goods sold (COGS) in your SMB. A guide with a formula, practical examples, and how to optimize it for higher profits.
Your business may be selling well and yet still leave you with an uncomfortable feeling at the end of the month. Cash is flowing, customers are coming in, the team is working nonstop, but profits do not appear as clearly as you expected. This happens to a coffee shop in Condesa, a car wash in the State of Mexico, a bakery in Puebla, and a gas station in Nuevo León.
The reason is usually the same. The owner looks at sales, promotions, and daily cash flow, but has not completely mastered the cost of goods sold (COGS). Without that number, operating becomes a mix of intuition, effort, and surprises. And surprises in finance are almost always expensive.
Table of Contents
Introduction: Why COGS is the Most Important Number You Are Not Seeing
What COGS does answer
Where owners get most confused
What Exactly is the Cost of Goods Sold
The logic behind the formula
What you should not include in COGS
Why gross profit matters so much
The Key Components of Your Cost of Production
Direct materials
Direct labor
Indirect manufacturing costs
The mistake of classifying by habit
How to Calculate COGS Step-by-Step in Your SMB
Step 1: Record your beginning inventory
Step 2: Add purchases and production costs
Step 3: Perform a physical count of ending inventory
A simple routine that actually works
Practical Examples of COGS by Type of Business
Specialty coffee shop in Puebla
Car wash in the State of Mexico
Comparison of COGS Components: Estimated Examples
Common Mistakes That Inflate Your COGS and How to Avoid Them
When inventory deceives
When costs change and you keep charging the same
Other frequent pitfalls
Beyond the Calculation: Use Data to Optimize Your COGS and Grow
From accounting data to operational decisions
What changes when you connect branch, customer, and margin
Introduction: Why COGS is the Most Important Number You Are Not Seeing
A coffee shop can sell dozens of drinks a day and still struggle to generate a profit. The problem is not always in sales. Many times it lies in not knowing precisely how much it cost to produce what has already been sold.
That is where COGS, or cost of goods sold, comes in. It is not an accounting technicality. It is the number that tells you how much money went into the products or services that actually generated sales. If you do not see it clearly, you may think you are doing well when in reality you are subsidizing every ticket.
In Mexico, controlling this data matters more than it seems. In 2025, Mexico reached a historic record for exports with 558.326 billion euros, and the manufacturing sector advanced 10% in its exports, highlighting that competitiveness depends on controlling costs with discipline (data cited by Infobae based on INEGI). In an SMB, the logic is the same, though on a different scale.
Rule of thumb: selling more does not correct a poorly calculated cost. Sometimes it only accelerates the loss.
Think of a car wash in Mexico City. The owner sees a line, hears machines running, and feels that the business is "moving." But if the shampoo, wax, water, electricity, and the operator's time cost more than they think, each premium wash may leave less margin than expected. The same happens in a bakery in Puebla when waste is not properly recorded, or in a coffee shop in Baja California when the cost of the main ingredient rises and no one adjusts recipes or prices.
What COGS Does Answer
COGS helps answer very specific questions:
How much did it actually cost me to sell what I already sold?
Does my current price leave a healthy margin or does it only give me volume?
Which branch or product line consumes the most resources?
Am I overbuying and leaving cash tied up in inventory?
When you understand this number, you stop managing blindly. You no longer set prices by intuition, nor do you buy "because it will be used," nor do you launch promotions without knowing if you are pushing profitable products or products that only generate work.
Where Owners Get Most Confused
Many small business owners mix up three different things: sales, cash flow, and profit. They are related, but they are not the same. You can have good sales and little cash. You can have money in the register for a few days and still operate with weak margins. And you can have an apparent profit that is actually inflated by a poor inventory count.
If the COGS is wrong, the income statement is also wrong. And if the income statement is wrong, your decisions are too.
What Exactly is the Cost of Goods Sold
The cost of goods sold is the value of the goods or services that actually left your operation to become a sale during a period. It does not include everything the business spends. It includes what was used to produce what you sold.
The base formula is simple:
COGS = Beginning Inventory + Purchases or Production Costs – Ending Inventory
That sounds technical until you put it into practice. In an ice cream shop in Mérida, for example, you start the month with mangoes, sugar, milk, packaging, and popsicles already finished in the freezer. Then you buy more supplies and produce more. At the end of the month, you still have some product and raw materials left. COGS is not everything you purchased. It is what was actually consumed to make sales.

The Logic Behind the Formula
Think of it like a pantry. If you start the month with supplies, then buy more, and at the end you have some left over, then what was sold is in the middle of those three movements.
Beginning inventory is what you already had.
Purchases or production is what you added.
Ending inventory is what was not sold or consumed.
What disappeared in a controlled manner, and ended up in sold products, makes up your COGS.
What You Should Not Include in COGS
This is where many get tangled up. COGS is not the same as the business's total expenses. There are costs that belong and others that do not.
Normally, costs linked to producing or rendering the service are included. Normally, administrative or commercial expenses such as office payroll, rent for the administrative area, or advertising campaigns are not included. These items affect net profit, but not gross profit.
Control point: if an expense exists even if you do not produce or sell a single unit, check carefully if it really belongs to COGS or to operating expenses.
Why Gross Profit Matters So Much
COGS is subtracted from sales to obtain the gross profit. That figure tells you if the core of your operation is healthy. Before talking about marketing, expansion, or new branches, you need to know if your product or service leaves a margin.
In Mexican SMBs, this has practical implications every day. If a coffee shop in CDMX sells a lot of coffee but each drink carries more cost than expected in milk, cup, lid, and waste, the gross profit drops. If a gas station with a convenience store in Nuevo León sells snacks and drinks without costing its purchases and leftovers correctly, it loses visibility on which line actually contributes.
The central idea is simple. COGS does not tell you how much you sold. It tells you how much it cost you to generate those sales.
The Key Components of Your Cost of Production
Once you understand the formula, the next natural question is this: what do I put inside "purchases or production costs"? That is the detail that defines whether your calculation is useful or just looks tidy in Excel.
According to the Financial Reporting Standards, COGS includes concepts such as raw materials, direct labor, indirect manufacturing costs, and outsourcing. This breakdown feeds the Balance Sheet and the Income Statement, and is especially useful for SMBs like car washes, bakeries, or coffee shops.

Direct Materials
These are the supplies that you can clearly relate to what you sell.
In a coffee shop in Puebla, this would be the coffee, milk, sugar, syrups, and cups. In a car wash in the State of Mexico, it would be shampoo, wax, air freshener, microfibers, and other chemicals consumed during the service. In a bakery in Yucatán, flour, butter, yeast, and fillings.
It pays to be very strict here. If the input goes directly into the product or service, it normally goes into this bucket.
Easy to identify: ingredients, packaging, service consumables.
Easy to forget: lids, straws, labels, napkins, wrappers.
Easy to underestimate: waste due to handling, expiration, or preparation.
If you want to dive deeper into the relationship between purchases and profitability, it is worth reviewing this guide on purchasing costs for inventory businesses.
Direct Labor
This is the cost of the personnel directly involved in producing what you sell.
Not all payroll goes here. The barista who prepares drinks, the baker who bakes, and the operator who does the car wash do. The receptionist, administration, or sales team do not necessarily.
Many owners pay the payroll and leave it out of COGS because "it was already accounted for." This approach distorts the margin. If production requires human time, that time costs money and must be reflected.
When a service depends on manual labor, ignoring direct labor makes the price look profitable even when it is not.
Indirect Manufacturing Costs
This is usually the biggest blind spot. These are expenses necessary for production, but which you cannot assign directly to a single unit.
Some common examples:
Production area services: electricity, water, gas.
Operational space: rent for the area where you produce or provide the service.
Equipment and wear: maintenance, depreciation, machinery use.
Production support: supervision, area cleaning, outsourcing linked to production.
In a coffee shop in Mexico City, the electricity for grinders and espresso machines falls into this category. In a car wash in Baja California, the use of vacuums, compressors, and part of the building's operational consumption do as well.
The Mistake of Classifying by Habit
Many businesses classify expenses based on "that is how we have always done it." This causes two problems. The first is that the COGS ends up incomplete. The second is that you then compare branches using different criteria and make unfair decisions.
An owner of several branches in Nuevo León might think that one unit "is less efficient," when in reality it is just absorbing its indirect costs better. Another branch may look more profitable, but only because it leaves out real costs.
A simple way to evaluate each expense is to ask yourself this question: if I temporarily stopped producing this product or service, would this cost disappear or decrease significantly? If the answer is yes, there is a good chance it should be analyzed within COGS.
How to Calculate COGS Step-by-Step in Your SMB
You do not need to be an accountant to calculate the cost of goods sold correctly. You do need a method. The biggest problem in SMBs is usually not the formula; it is the discipline to capture the right data at the right time.
Step 1: Record Your Beginning Inventory
Beginning inventory is the value of what you have at the start of the period. It could be the first day of the month, quarter, or week, depending on how you manage your business.
This is not about guessing. It is about counting and valuing.
In a bakery, beginning inventory includes flour, sugar, butter, packaging, and also finished product available for sale if applicable. In a car wash, it would include chemicals, consumables, and materials ready for use.
Step 2: Add Purchases and Production Costs
During the period, record everything that is purchased and everything that is integrated into the production cost. Do so with supporting documentation: invoices, notes, and internal records.
Here is a good operating practice: if your point of sale and your inventory control are connected, you capture fewer errors and see what goes out much better. This resource on point of sale with inventory helps to understand that relationship within daily operations.
Do not mix expenses that do not belong to the production process into this stage. If you include everything, the calculation stops being useful for making decisions.
Step 3: Perform a Physical Count of Ending Inventory
Ending inventory is what you have left at the close of the period. This step seems simple, but it is where the most fictitious profit is created.
A clear reference shows this well. In a bakery in Monterrey, with $40,000 MXN in beginning inventory, $80,000 MXN in purchases or production, and $20,000 MXN in ending inventory, the COGS is $100,000 MXN (detailed example).
The math is direct:
Beginning inventory: $40,000 MXN
Plus purchases and production: $80,000 MXN
Minus ending inventory: $20,000 MXN
COGS Result: $100,000 MXN
The relevant data is not just the result. It is what happens if you make a mistake. If you underestimate ending inventory by 10%, you artificially inflate gross profit by $10,000 MXN, according to the same example and source. This error is common in SMBs and completely changes the reading of the business.
Operational tip: ending inventory is not "estimated to get it over with." It is counted. Otherwise, the margin you see may be an illusion.
A Simple Routine That Actually Works
If you want to make this manageable, do it like this:
Define a fixed period: every week or every month, but always the same.
Use the same unit of measure: kilos, liters, pieces, boxes.
Close purchases on time: do not leave pending invoices for "later."
Count physically: do not rely solely on what "should be there."
Review discrepancies: if something does not match, investigate waste, theft, error, or poor entry.
In businesses with several branches, it is best if they all follow the same criteria. If one location in Puebla registers by pieces and another in CDMX by boxes, comparing them later will not work.
Practical Examples of COGS by Type of Business
The formula is the same for everyone. What changes is the composition of the cost. It does not cost the same to prepare a cappuccino as it does to do a premium wash, even if both are sold as a customer experience.
Specialty Coffee Shop in Puebla
Think of a drink served at a bar with careful operation. The cost of that cappuccino is not just the coffee.
It includes several elements:
Direct material: beans, milk, cup, lid, napkin.
Direct labor: barista's time to grind, extract, and serve.
Allocated indirects: machine electricity, area cleaning, equipment wear.
In food and beverage businesses, materials usually carry a significant portion of the cost. In restaurants, COGS typically consists of 50-60% direct materials, 20-30% direct labor, and 15-25% indirect expenses, and a 5% increase in labor due to turnover can reduce the gross margin from 35% to 30% (breakdown reference and its effect).
That explains why a coffee shop that rotates a lot of staff can make the same sales and earn less. The customer might not even notice. The income statement definitely does.
Car Wash in the State of Mexico
Now let's change the scenario. In a car wash, you do not "manufacture" a traditional physical product, but you do consume direct resources to provide the service.
A premium wash can include:
shampoo and wax
air freshener
microfibers and consumables
operator's time
portion of water and energy use
part of the equipment wear and tear
Here, labor and indirect costs usually weigh more heavily in the operational analysis. If the service takes longer due to poor organization, if the equipment fails, or if an operator uses more material than necessary, the cost goes up without the price necessarily adjusting.
Comparison of COGS Components: Estimated Examples
Cost Component | Coffee Shop (1 Cappuccino) | Car Wash (1 Premium Wash) |
|---|---|---|
Direct materials | Coffee, milk, cup, lid | Shampoo, wax, air freshener |
Direct labor | Barista preparation | Operator's time |
Indirect costs | Equipment electricity, cleaning, wear | Water, power, machinery wear |
Common operational risk | Input waste and overportioning | Excessive use of consumables and long times |
If you manage food, it can be helpful to complement this logic with a practical guide on how to calculate the cost of a dish.
The same method works in different sectors. What changes is not the formula. It is how disciplined you are in capturing the real cost of each operation.
Common Mistakes That Inflate Your COGS and How to Avoid Them
Calculating COGS once solves nothing if the data is fed by bad habits. Most mistakes are not born in accounting. They are born on the operations floor.

When Inventory Deceives
The first mistake is trusting "approximate" inventories. A manager says there is enough product. The owner buys based on that. At the close, the physical count shows a different reality.
To avoid this:
Perform frequent counts: do not leave everything for the end of the month.
Separate waste from actual consumption: what spoiled is not the same as what was sold.
Use consistent units: liters with liters, kilos with kilos, pieces with pieces.
The opposite also happens. There are businesses that buy a lot out of fear of running short and end up locking up cash in the warehouse. That money does not disappear, but it stops being available for payroll, maintenance, or campaigns that actually generate a return.
When Costs Change and You Keep Charging the Same
Another very common mistake is using old costs. In food and beverages, this hits immediately. In Mexico, the cost of raw materials for food and beverages rose 18% between 2025 and 2026, and not adjusting this change in the COGS calculation can lead to underestimating the actual cost and pricing at a loss (data cited in this reference).
If a coffee shop in CDMX continues costing milk, coffee, or packaging using prices from months ago, it might think a promotion still leaves a margin when it no longer does.
Other Frequent Pitfalls
Mixing administrative expenses with production costs: this distorts the gross profit.
Not recording waste: wasted supplies also cost money.
Not allocating indirect costs reasonably: electricity, production rent, and maintenance do not disappear just because you ignore them.
Not reviewing by branch: one location may be profitable and another not, even if they sell the same thing.
Unrecorded waste and unallocated indirect costs are two very common ways to deceive oneself.
Beyond the Calculation: Use Data to Optimize Your COGS and Grow
COGS is not just for closing reports. It is for making better decisions tomorrow morning. If you already know how much it costs you to produce what you sell, you can use that data to adjust purchases, promotions, product mix, recipes, service times, and commercial focus.

From Accounting Data to Operational Decisions
Many owners calculate the cost at the end of the month and file it away in a folder. That is no longer enough. The real value appears when you connect cost with sales behavior.
For example, if a coffee shop in Baja California identifies which products sell more on certain days and times, it can buy better, produce better, and waste less. If a car wash in the State of Mexico detects which package sells the most per branch, it can design promotions on services with better margins rather than on those that are already tight.
What Changes When You Connect Branch, Customer, and Margin
This is where the most strategic part comes in. According to CANACO data, 68% of SMBs in Mexico underestimate their indirect costs per branch, leading to error margins of over 30%, and connecting COGS with CRM metrics helps adjust costs per branch and consumption habits (data and context in this reference).
This means it is no longer enough to know "how much my business costs." You need to know:
which branch consumes the most indirect costs
which customers buy products with the best margins
which promotions drive volume without destroying profits
which days and hours generate overproduction
A platform like Swirvle can centralize customers, branches, campaigns, and sales attribution so that the business relates customer retention and consumption to commercial and operational decisions. In practice, this helps segment campaigns, observe purchase patterns, and adjust what is produced or promoted at each point of sale.
It is not about blindly "cutting costs." It is about selling better, producing with less waste, and protecting margins.
When you do this well, the cost of goods sold stops being a report of the past and becomes a growth tool. You no longer just look at how much it cost to sell. You start deciding what is best to sell more of, where, to whom, and with what frequency.
If you want to turn customer, campaign, and branch data into more profitable decisions, Swirvle allows you to connect loyalty, segmentation, and sales attribution in one place. For an SMB with physical stores, this makes it easier to detect which actions increase customer retention, which products leave the best margins, and where your operation is consuming profits without you noticing.
`
Related Blogs

Aug 5, 2026
10 dessert ideas to sell that actually work in 2026

Aug 3, 2026
Price elasticity: a practical guide for SMEs

Aug 1, 2026
Why offer dessert? Easily increase your average sale

Jul 30, 2026
Resource allocation: a practical guide for SMEs 2026

Jul 28, 2026
Swirvle: better than a digital punch card app

Jul 27, 2026
Consistency in customer service: the secret to selling more without being perfect
Try Swirvle for free
No card required · 30 days free
Start your free trial
