How is Cost of Goods Sold Calculated?

To calculate cost of goods sold, first start with the beginning inventory. Then and the cost of the goods that were purchased. From that, subtract ending inventory.