When the coffee shop sells a bag of beans, the income statement needs to record what that bag cost the shop. This sounds trivial, but the shop bought beans many times at many prices, and the bags sit mixed together in the storeroom. Say it bought 100 bags in January at $10 each and 100 more in June at $14 each after coffee prices rose. A customer buys one bag in July for $25. Which cost should be recorded, $10 or $14? Nobody tracks which physical bag left the shelf, so accounting lets the company choose a rule, and the two main rules give different answers.
FIFO stands for first in, first out. It assumes the oldest bags sell first, so the July sale is costed at the January price of $10, and the profit on that bag is $15. The bags still on the balance sheet are then assumed to be the newest ones, valued at $14, which is close to what beans actually cost today.
LIFO stands for last in, first out. It assumes the newest bags sell first, so the same sale is costed at $14 and the profit is $11. The balance sheet keeps the oldest costs, showing inventory at $10 a bag, a price that may be years out of date.
It is the same shop, the same bag, and the same $25 in the till, yet reported profit differs by $4 purely because of which rule was chosen. Across a company's entire inventory, that choice moves profits by millions.
When prices are rising, which is the usual state of the world, FIFO reports higher profit and a more realistic inventory value, while LIFO reports lower profit and a stale one. You might wonder why any company would choose to look less profitable. The answer is taxes. Lower reported profit means a lower tax bill, so LIFO lets a company keep more actual cash during inflation at the price of uglier numbers. FIFO flatters the income statement and LIFO protects the cash.
Two things are worth knowing before you compare companies. Different methods produce different margins and different inventory values, so if you compare two industrial firms, first check the inventory note in the annual report (see notes to the financial statements) to see which method each uses. Comparing a FIFO company against a LIFO one during inflation is quietly unfair to the LIFO one. Also, LIFO is banned under international accounting rules, so it exists essentially only in the United States. European companies all use FIFO or similar methods, which means this issue mostly appears when American firms are involved.
The inventory method belongs to the same family as depreciation lives and reserve estimates. It is a legal, disclosed choice that changes the numbers without changing the business, and the defense is the same as always: cash does not care which rule was picked.