Guide

How inventory costing works, and why your margin looks wrong

You bought the same product twice at different prices. You sold some of it. The profit on that sale is not a fact you can look up — it depends on a rule you chose, possibly without knowing you were choosing.

What costing is for

A quantity is easy: there are 120 boxes on the shelf. A value is a decision, and two of your financial statements depend on it.

It splits one number in two

Everything you have ever bought is either still on the shelf or has been sold. Costing decides where the line falls: one part becomes stock on the balance sheet, the rest becomes cost of sales in the income statement.

It sets your gross margin

Revenue is what the customer paid, and that part is not in dispute. Cost of sales is the half of the margin you compute, which is why two honest systems can report different profit on identical trading.

It has to agree with the ledger

Whatever the stock report says on-hand stock is worth, the inventory account in the general ledger has to say the same. A valuation that only exists in a warehouse screen is a number nobody can defend.

Three methods, and the sentence each one is usually sold without

They are all defensible. They are not interchangeable, and none of them is the true one.

FIFO

First in, first out

Stock is held as layers, each remembering what it cost. A sale consumes the oldest layer first, so the balance sheet carries stock at roughly what it costs today.

The cost of a sale depends on purchases made months ago, so the system has to keep every layer and walk it on the way out. When prices are rising, FIFO reports the highest profit of the three — which is flattering, and taxable.

Weighted average

One cost per product, re-blended on every receipt

Receiving goods blends the new cost into the old one, weighted by quantity. Everything that leaves is costed at the average in force at that moment.

No layers means no history to reconcile, but also no way to say which specific purchase a sale consumed. A single unusual purchase price drags the average for every unit still on the shelf.

Standard cost

A planned cost, set in advance

Stock is valued at a figure you decide, and the gap between the plan and what you actually paid is posted to a variance account rather than buried in margin.

It makes margins comparable between periods, which manufacturers want. It also means somebody has to maintain the standards, and a standard nobody revisits quietly turns the variance account into the real story.

LIFO exists too. It is prohibited under IFRS and rare outside the United States, and it is not in this product, so it is left out of the comparison below.

A worked example: buy 100 at 10.00, buy 50 at 13.00, sell 30

Weighted moving average, three events, every figure shown. This is exactly what happens inside Ledgerly when you record a goods receipt and then ship an order.

EventMovementOn handStock valueAverage cost
Goods receiptNothing to blend with, so the incoming cost is the average.100 units at 10.001001,000.0010.00
Goods receipt1,650.00 ÷ 150. Not 11.50 — the blend is weighted, not a midpoint.50 units at 13.001501,650.0011.00
DeliveryCosted out at 11.00 → cost of sales 330.00. The average does not move.30 units out1201,320.0011.00
Cost of sales

330.00

30 units at the 11.00 average in force.

Stock remaining

1,320.00

120 units, still at 11.00 each.

Reconciles

1,650.00

330.00 out plus 1,320.00 left is what you paid, to the cent.

The average is 11.00, not 11.50. Averaging the two prices would ignore that you bought twice as many at the lower one. And the delivery does not disturb it: goods leaving take value out at the rate already established, which is the property that makes the method cheap to compute.

The same sale, three different profits

Sell those 30 units for 20.00 each — revenue of 600.00 on every row. Nothing about the trading changed. Only the rule did.

MethodCost of the 30Stock leftGross profit
FIFO300.001,350.00300.00
Weighted average330.001,320.00270.00
Standard cost at 10.50315.001,260.00285.00

FIFO takes the 30 from the batch bought at 10.00, so it books the cheapest cost and the highest profit. Standard cost books 315.00 and leaves the 75.00 gap between the 1,650.00 you actually paid and the 1,575.00 you carried in a purchase price variance account, where it is at least visible rather than smeared across margins.

The spread here is 30.00 on 600.00 of revenue — five points of margin, from a choice nobody in the business made consciously. Multiply it by a year of trading and it is the difference between a healthy product line and one you were about to discontinue.

It is a timing difference, not free money

Over the whole life of a product, the total cost of sales is the same under every method: you can only expense what you paid. The method decides which period gets which slice. That is genuinely important for tax and for period-on-period comparison, and it is also why arguing about which one is more accurate misses the point — what matters is picking one and staying with it.

What moves the average, and what does not

Most confusion about a costing figure comes from not knowing which events touch it.

Goods receipt
Blends the incoming cost into the average, weighted by quantity. This is the only routine event that moves it.
Delivery or issue
Costs the goods out at the average in force and leaves it exactly where it was.
Warehouse transfer
Moves quantity between warehouses. The average is held per product, not per warehouse, so it does not change.
Stock count, upward
Values the extra units at the current average and books a gain, unless you give an explicit cost — which is how an opening balance is established.
Stock count, downward
Removes value at the current average and books the shortfall as a loss. Nothing is quietly written off.
Void
Books a reversing journal entry rather than deleting the original. The stock ledger is append-only, so the history of the average stays readable.

When stock goes negative

It happens in every real warehouse: a delivery gets recorded before the goods receipt that supplied it, or a purchase is entered late. The costing has to survive it.

The issue is not blocked

Ledgerly lets the quantity go negative rather than refusing the delivery or silently capping it at zero. The goods physically left the building; a stock ledger that disagrees with that is worse than one showing minus three.

It costs out at the last known average

There is no better number available at that moment. If the goods you eventually receive cost something different, the cost of sales already posted was too high or too low, and the stock value on the balance sheet is temporarily negative.

The receipt does not blend

Blending a real cost against a negative quantity produces an average that means nothing — it can come out negative. So a receipt into negative stock adopts the incoming cost outright, and the position is correct again from that point on.

What that does not do is restate the entry already in the ledger. If the difference matters, void the delivery and record it again after the receipt: the void books a reversal of what was posted, and the new delivery costs out at the corrected average. Nothing is edited in place, so the correction is visible to whoever looks later.

Better still, do not get there. Sales screens show what is available rather than what is on hand — on hand minus the quantity confirmed orders have already committed — and reorder points flag a product before the shelf empties.

What Ledgerly does, and what it will not do

Weighted moving average, one cost per product, and no FIFO. The second half of that sentence is the honest part.

One number per product

Quantities are tracked per warehouse; the cost is a single figure per product across all of them. That is what lets a delivery compute its own cost of sales instantly, without walking a stack of purchase layers.

Costed in the same transaction

Because the cost is available immediately, the journal entry that credits stock and debits cost of sales is posted in the same database transaction that moves the quantity. There is no overnight costing run and no window where stock has moved but the books have not.

Auditable after the fact

The stock ledger is append-only and every movement records the average it produced, so you can follow a cost back to the receipt that set it. The stock valuation report reconciles to the inventory account in the general ledger.

Exact arithmetic

Averages divide, and division is where costing systems lose cents. Amounts are stored in decimal columns and computed in whole minor units, never in floating point, so a valuation still reconciles after a hundred thousand movements.

Not in this product

There is no FIFO, no LIFO and no standard costing — one method, not a setting. The average is per product, so you cannot value the same product differently in two warehouses. There is no multi-currency, so costs are in one currency and no exchange rate ever moves an average. If your accountant or your jurisdiction requires FIFO layers, this is the wrong product, and it is cheaper to learn that here than after you have loaded your catalogue.

Next: what a balanced journal entry actually is →

Keep reading

Costing is one rule inside a larger system. These cover the rest of it.

Try it with two receipts

Create a product, receive it twice at different prices, ship some of it, then open the stock valuation and the trial balance. The average, the cost of sales and the inventory account will agree. That takes about five minutes.

Start free

Or go back to the overview.